Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User rj_cybersilver's Avatar
    Join Date
    Dec 2004
    Location
    quezon city philippines
    Posts
    25
    is there a File class equivalent in J2ME?
    Hi! I was wondering if there was an equivalent class in j2me to the File Class in java's standard edition? i need to know if i could somehow get the files stored in a particular folder and use those files i get in my midlet and forms. Can somebody help me? I've been going over the API and to this time I haven't found anything useful yet.

    any ideas? thanks.. ^_^

  2. #2
    Registered User brilleaben's Avatar
    Join Date
    May 2003
    Posts
    32
    Well, it is not exactly a file class ... but:

    InputStream iS=getClass().getResourceAsStream("/file.txt");

  3. #3
    Registered User hvogeler's Avatar
    Join Date
    Mar 2005
    Posts
    3
    File access in J2ME is done via jsr75 file connection api. It is included in the series 60 sdk e.g. You open a file connection via the normal Connector class. Use an url like "file:///c:/somefolder/file.txt". You get a FileConnection object you can use to do everything you normally do using java.io.File.

    Does that help you?

    Heiko

  4. #4
    Registered User rj_cybersilver's Avatar
    Join Date
    Dec 2004
    Location
    quezon city philippines
    Posts
    25
    Originally posted by brilleaben
    Well, it is not exactly a file class ... but:

    InputStream iS=getClass().getResourceAsStream("/file.txt");
    sir the problem with this code is that i would still have to know and specify the exact file-name as a parameter of the getResourceAsStream method. the situation calls for a way for me to traverse the diferent directories in the mobile phone's memory, look for the folder where the mobile phone stores the images it captures and get the filenames of these images.
    I might be mistaken sir..it would be a blessing if you could explain to me how this code could work for me? Thank you for sharing your expertise with me.

  5. #5
    Registered User rj_cybersilver's Avatar
    Join Date
    Dec 2004
    Location
    quezon city philippines
    Posts
    25
    Originally posted by hvogeler
    File access in J2ME is done via jsr75 file connection api. It is included in the series 60 sdk e.g. You open a file connection via the normal Connector class. Use an url like "file:///c:/somefolder/file.txt". You get a FileConnection object you can use to do everything you normally do using java.io.File.

    Does that help you?

    Heiko
    it does help me. ive been using java's wireless toolkit 2.2.is there any way for me to annex this jsr75? or is this only available in the series 60 sdk?

  6. #6
    Registered User brilleaben's Avatar
    Join Date
    May 2003
    Posts
    32
    Yes, you're right. If you know the path then my suggestion can be used.
    Otherwise you'll have to resort to the aforementioned JSR - if that is supported on your target phone.

  7. #7
    Registered User rj_cybersilver's Avatar
    Join Date
    Dec 2004
    Location
    quezon city philippines
    Posts
    25
    sir, this might sound stupid, but how do I know if my target device supports the aforementioned jsr? My target device is any series 60 device using midp2.0 profile.

  8. #8
    Registered User brilleaben's Avatar
    Join Date
    May 2003
    Posts
    32
    Ehrm - no, it is not a stupid question :-) Unfortunately I cannot answer it. Perhaps if you dig a bit on java.sun.com???

  9. #9
    Registered User pfrizzell's Avatar
    Join Date
    Jul 2003
    Location
    New Zealand
    Posts
    12
    The JSRs implemented are listed against the specs for each phone on the Nokia forum.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved