Sorry if I caused you any offence. I'm just like any other person trying to find a better solution to the one I have already. So thank you for your constructive or in this case unconstructive comment.
By the way, next time you decide to hurl some abuse over please choose to construct and spell your sentences properly.
I really don't care about spelling. As far as I know, you knew exactly what I ment, so it's just fine. Besides, not all of us have English as our native language. I would like to see you cope with Ducth....
About beeing constructive: I was, you just didn't read past the fist paragraph!
To be even a bit more constructive...
Since J2me does not have a BufferedInputStream, it will help to implement it yourself. It's much faster since you read large blocks at ones in stread of seperate chars.
something line this lets you read lines very fast:
while ( bytesread < filesize ) {
length = configfile.read( buff, 0, buff.length );
// append buffer to temp String
if ( length < buff.length ) {
byte[] buf = new byte[length];
System.arraycopy( buff, 0, buf, 0, length );
tmp.append( new String( buf ) );
} else {
tmp.append( new String( buff ) );
}
// look in tmp string for \r\n
idx1 = tmp.toString().indexOf( "\r\n" );
while ( idx1 >= 0 ) {
//if found, split into line and rest of tmp
line = tmp.toString().substring( 0, idx1 );
/// ... do with it whatever you want ... ////
tmp = new StringBuffer( tmp.toString().substring( idx1 + 2 ) );
idx1 = tmp.toString().indexOf( "\r\n" );
}
bytesread += length;
}