Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Passing InputStream to another method

807605Aug 17 2007 — edited Aug 19 2007
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? ;-)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 16 2007
Added on Aug 17 2007
12 comments
3,755 views