Forums Register Login
nested objects
hello. If anybody has a minute, if I initialized a buffered reader like this...

BufferedReader rd = new BufferedReader(new FileReader(file));

and called


does the rd.close() still leave the FileReader stream out there...potentially causing memory problems if the code runs in many iterations? thank you.
Hi Tom,

By convention, close() does the right thing -- i.e., it calls close() on any "nested" streams. All the input and output streams (as well as readers and writers) that are part of the Java standard library behave this way.
And if they don't they're broken, because FilterInputStream etc all mention that subclasses must close the underlying stream etc as well.
thank you very much.
please buy this thing and then I get a fat cut of the action:
Thread Boost - a very different sort of advertising

This thread has been viewed 678 times.

All times above are in ranch (not your local) time.
The current ranch time is
Apr 24, 2018 22:31:31.