Reputation: 19582
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?
Upvotes: 0
Views: 60
Reputation: 2113
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.
Upvotes: 2