java - What happens to an Output Stream/Input Stream object reference after calling close method? -
when call close() method on object reference outputstream/inputstream object, object reference pointing null? or need explicitly set null make object memory available gc?
no. close() free underlying resources , objects, object still exists.
actually, close() may not anything, example, in bytearrayinputstream
/** * closing <tt>bytearrayinputstream</tt> has no effect. methods in * class can called after stream has been closed without * generating <tt>ioexception</tt>. */ public void close() throws ioexception { } you can call close() on it, , still use nothing happens.
Comments
Post a Comment