Reading from a big.txt file on MIDP

Hi guys,

I get the following output from this:

Uncaught exception java/lang/OutOfMemoryError.

I dont even get the "Start" output so it must be overload when it loads the file.

The textfile im reading from is 2.6 mb so its big. Can someone give me a better way to read from this file?

InputStream inputStream = this.getClass().getResourceAsStream("sjukdomar.txt");

System.out.println("Start");

try{

int chr, i = 0;

// Read until the end of the stream

while ((chr = inputStream.read()) != -1){

System.out.print((char)chr);

}

}

catch (Exception e){

System.out.println("Unable to create stream: "+ e.toString());

}

System.out.println("Finished");

[1214 byte] By [tolvana] at [2007-11-27 7:49:52]
# 1
you want to put on a device a MIDlet with a 2.6MB text file or you want that the user download a 2.6MB text file on the device?
suparenoa at 2007-7-12 19:30:50 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

> you want to put on a device a MIDlet with a 2.6MB

> text file or you want that the user

> download a 2.6MB text file on the device?

I have a MIDlet that uses a PointBase database. When I install the program I will put a 2.6 MB textfile on the device and I want my program to create the data in the PointBase database from that .txt file.

So yes I want to put on a device a MIDlet with a 2.6MB text file. NO Download.

The problem is that I cant get this code to work even on my emulator on the desktop computer.

tolvana at 2007-7-12 19:30:50 > top of Java-index,Java Mobility Forums,Java ME Technologies...