Forums Register Login

Store huge file to RMS (More than 100kb)

+Pie Number of slices to send: Send
My application will connect to internet and get a huge image file, my problem is i was unable to save the image file to the RMS. My application will throw out of memory exception. Is't the byte[] byteArray; cannot store more than 64kb data? If that is the case how can i display images or video more than 64kb?

this is my sample code (http connection):
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream strmDataType = new DataOutputStream(baos);
for(int i =0 ; i < length ; i++ )
{
c = in.read();
strmDataType.writeByte(c);
}

strmDataType.flush();
byteArray = baos.toByteArray();
strmDataType.close();
baos.close();
strmDataType = null;
baos = null;

I will get "uncaught error: out of memory" when i try to download an image more than 80kb.

is't possible to contruct an image object more than 100kb?
myImage = Image.createImage(raw, 0, raw.length);

Thanks
+Pie Number of slices to send: Send
thats, ok, but I sugest that use the readFully() method, for faster
+Pie Number of slices to send: Send
You are not required to store video/audio data to RMS before playing it.
Only if you want to retrieve and play it again it later from the RMS ...

MMAPI lets you play audio/video data from an URL directly ...

Most devices will probably not allow much RMS data... anyway you may try reserving as much as possible using MIDlet-Data-Size ... (check the MIDP 2.0 specs).
Lookout! Runaway whale! Hide behind this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1023 times.
Similar Threads
Encoding/decoding problem
how to save a image in j2me
can we store an integer in a byte array
cant store images
network transfer of image
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 02:37:34.