|Re: Why does IFile.setContents, IFile.create and so on close stream? [message #516143 is a reply to message #516079]
||Mon, 22 February 2010 15:08
| Ed Merks
Registered: July 2009
Mickael Istria wrote:
> I just faced an annoying behavior (from my point of view) with IFile,
> and I think there are probably arguments to explain it that I'd love
> to understand.
> As described in title IFile.setContents, IFile.create & co close the
> InputStream we give to it. AFAIK, a good practice is to let the
> creator of the stream close it. This is particularly annoying when
> manipulating a ZipInputStream, that gets closed although there are
> some remaining entries into it.
This is probably the only time it's annoying given that the input stream
will have been fully consumed to populate the resource. So generally,
closing the stream is the only useful thing left to do. It's clear that
it would be impossible to change this behavior now, so best live with
it. Perhaps use a FilterInputStream that overrides close to do
> Thanks to anyone who could give me insight about this behavior ;)
> Mickael Istria - BonitaSoft S.A.
Powered by FUDForum
. Page generated in 0.02526 seconds