Size of a resource
i have a question concerning the size of a resource file.
I'm trying to open a file containing large amount of data, by using inpustream.
The file is pretty big: 49k. But i was planning to use even bigger file: 100 k if needed...
when i want to access the data in the file, i use a datainpustream over an inpustream.
i thought that by this way, i would be able to access data byte by byte without loading all the file in memory, and so the size of the file would'nt matter.
but actually it seems that the file is totally loaded in memory anyway, and i get out of memory pretty quickly.
Is there a way to access data of a file little by little, without loading all the file in memory?
Can i control the size of the part of the file i can load in memory?
thx in advance.
Most (probably all) j2me implimentations load the whole file into memory when you open it.
If you are thinking, thats abit pointless, why give the programmer functions to read the file byte by byte if you have already loaded the whole file into memory .. you would be right
It wouldn't be so bad if you could access the file once its loaded into memory, but no, you have to allocate more memory and copy the file into your memory before you can actually use it ...
I imagine there is some technical reason why phones do this (possibly the programmers were just lazy) .. who knows ..