On 9 Dec 2006, at 16:58, Bogdan Stefanescu wrote:
Yes you are right. But more, it is not guaranteed that the input
stream will be closed by the garbage collector!
This depends on the stream implementation.
For FileInputStream it is true (i.e. GC will close the stream).
If you look inside class source you have a finalize() method that
is doing this:
protected void finalize() throws IOException {
if (fd != null) {
if (fd != fd.in) {
close();
}
}
}
But the finalize() method is not mandatory and some implementors
may not implement it.
Well, I hope any reasonable implementation would do that!
Gratuitously leaking fds is not a reasonable implementation :)
Florent
--
Florent Guillaume, Director of R&D, Nuxeo
Open Source Enterprise Content Management (ECM)
http://www.nuxeo.com http://www.nuxeo.org +33 1 40 33 79 87
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm