×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998

    How to read and write a binary file in J2ME

    Hi All,

    I would like to know if there is any examples to read and write a binary file in J2ME. Also would like to know if writing is possible, how good the performance would be?

  2. #2
    Regular Contributor
    Join Date
    Dec 2007
    Posts
    122

    Re: How to read and write a binary file in J2ME

    Writing is only possible with RMS.
    take a look here for example
    As I understood performance are really different between different mobiles...


    For reading a file, just add the file as a resource open it and read it as you wish?

  3. #3
    Registered User
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998

    Re: How to read and write a binary file in J2ME

    Hi,

    Thanks for your reply. Sorry, I did not mention that I need to read from the memory card. The files cannot be added with the jar as a resource. And I would like to know apart from RMS is there any solution.

  4. #4
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,569

    Re: How to read and write a binary file in J2ME

    JSR-75, FileConnection API.

  5. #5
    Registered User
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998

    Re: How to read and write a binary file in J2ME

    Hi,

    Thanks Petrib. I had gone thru that JSR-75, however was not able to use it properly. Is there any example on JSR-75. Basically I am looking out for something like fwrite and fread in Symbian C++.

    Also I read that it can be a bit annoying to be prompted every time the MIDlet accesses the file system, if JSR-75 is used. Is there any other method.

  6. #6
    Registered User
    Join Date
    Feb 2008
    Posts
    7

    Re: How to read and write a binary file in J2ME

    I am competely new to J2ME, but I also want to be able to especially write binary files to the SD card. Through the links posted here, and searching google on JSR 75, I found the 'Getting started with the FileConnection AIPs' tutorial by Sun. After I read it, I feel pretty confident it is possible to read and write files from and to the device.

    The article can be found at
    http://developers.sun.com/mobility/a...ileconnection/
    It also includes some examples.

    I just also discovered the Wiki (as I said, I am truly new here ), with an example of writing data to a file.
    http://wiki.forum.nokia.com/index.ph...ile_in_Java_ME

    Hope it helps! Cheers, Daan

  7. #7
    Registered User
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998

    Re: How to read and write a binary file in J2ME

    Hi Daan,

    Thanks for the links. I had gone thru that .

    Even there is an example at ForumNokia
    http://www.forum.nokia.com/info/sw.n..._0_en.zip.html

Similar Threads

  1. Read and Write the encrypted data form file
    By ankushbabrekar in forum Symbian
    Replies: 6
    Last Post: 2007-04-18, 10:53
  2. Read and Write a custom settings file....
    By skhimsara in forum Symbian
    Replies: 2
    Last Post: 2006-04-25, 06:01
  3. write and read binary data to file
    By sunny_singh in forum Symbian
    Replies: 0
    Last Post: 2005-10-18, 10:01
  4. read text file
    By ivan6502 in forum Mobile Java General
    Replies: 1
    Last Post: 2005-01-17, 21:10
  5. write and read a TInt data from the file
    By billqu in forum Symbian
    Replies: 2
    Last Post: 2004-12-27, 15:10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×