When we pass an InputStream or a Reader to an InputSource who/when is the stream/reader is to be closed?
In the example in saxproject the streams/readers are not closed.
Why? Am I not supposed to close these streams?
When we pass an InputStream or a Reader to an InputSource who/when is the
Share
It’s good practices to close resources when you’re done using them (if you created them). I’d say the saxproject sample code is sloppy.
As for the “who” – a heavy-weight resource should generally be closed/freed within the scope that created it (and thus owns it) to avoid ownership confusion.