Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Why does IFile.setContents, IFile.create and so on close stream?
Why does IFile.setContents, IFile.create and so on close stream? [message #516079] Mon, 22 February 2010 12:25 Go to next message
Eclipse UserFriend
Hi,

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.

Thanks to anyone who could give me insight about this behavior ;)

--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
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 Go to previous message
Eclipse UserFriend
Mickael,

Comments below.

Mickael Istria wrote:
> Hi,
>
> 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
something else.
>
> Thanks to anyone who could give me insight about this behavior ;)
>
> --
> Mickael Istria - BonitaSoft S.A.
> http://www.bonitasoft.com/products/downloads.php
Previous Topic:"Problems" view/tab does not show any entries for a Java project
Next Topic:Eclipse 3.5 AIX - Failed to retrieve default libraries for /TOOLBOX/aix/JDK/jdk1.6.0_00
Goto Forum:
  


Current Time: Tue Apr 29 06:33:30 EDT 2025

Powered by FUDForum. Page generated in 0.03048 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top