J2ME Loading a File

Started by
4 comments, last by pinacolada 18 years, 11 months ago
Hi. Does anyone know how to read the content of a simple Textfile located on a mobile phone? As far as I know there ist no FileInputStream Method in the CLDC. Sourcecode would be great :)
Advertisement
Most phones don't support reading from the phone's permanent memory, but only from your own jar file (using Class.getResourceAsStream(), and we are talking read-only here) and reading/writing to the RMS.

Only the newest devices will support JSR-75 which includes access to the file system, and for these you would do it using the general connection framework, so it's like getting/sending data from/to a remote server, except you pass a file:// url to Connector.open().

Some older phones support file access without JSR-75, but with these you'll have proprietary classes so it depends on the phone (for example, older Siemens phones have a proprietary File class).

shmoove
Hi shmoove, sorry to hijack this thread... but could JSR 75 also be used to access the phones image gallery?
Thanks
Yes, assuming you know the path to that directory, and the phone's manufacturer's haven't gone out of their way to block that capability. And the path would probably change from phone to phone. And you would also need to know what images are there, since there are no methods to get directory listings as far as I can remember.

shmoove
if i can't write to phones how do i save highscores and such?
use a RecordStore

example

This topic is closed to new replies.

Advertisement