I have a problem with a parsing system I'm trying to implement for my app. It involves passing an InputStream that hasn't been finished being read into another method, kinda something like this:
public void load( InputStream stream ) {
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
try {
// ... read a few first lines of the stream, until
aSubDataType.load(stream); // I try to pass the unfinished stream to be read by another object
// finish read the rest of the stream for this data type
} catch (IOException e) { ... }
}
but everytime the stream is passed into the secondary method, any String read from it is null >.< resulting in inexplicable NullPointerException everywhere.
Any ideas? ;-)