[Advanced-java] (style question?) who closes the resource..
Robert Helmer
robert at roberthelmer.com
Wed Aug 27 06:56:26 2003
Hello,
Is it generally expected by most Java programmers here that a
method that accepts a resource (say an InputStream) will
possibly close that InputStream, or would you expect that
to be the job of the caller?
I'd assume the latter, but it's not always possible to know
when the caller will be getting control back (if ever)...
I suppose you could document that the resource will be closed
in the JavaDoc, but I don't recall ever seeing that before.
Any opinions?
Thanks,
Rob