Hi, I'm getting an OutOfMemory exception on a E50 while trying to load a 700kb text file for parsing from the JAR.
The code works with smaller files and now and then with this one too.
The exception is throw in the loop (in red). Since I'm new to J2ME, I don't really know how to deal with that.
Any tips?



ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
InputStream istream = getClass().getResourceAsStream(fileToLoad);
boolean done = false;

while (!done) {
int count = istream.read(buffer);
if (count == -1) {
done = true;
} else {
baos.write(buffer, 0, count);
}
}


BR,

Cleber