• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Store huge file to RMS (More than 100kb)

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thats, ok, but I sugest that use the readFully() method, for faster
 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
reply
    Bookmark Topic Watch Topic
  • New Topic