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");

