Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 17:25 Go to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

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 20:08 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33187
Registered: July 2009
Senior Member
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


Ed Merks
Professional Support: https://www.macromodeling.com/
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: Sat Jul 27 05:19:28 GMT 2024

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

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

Back to the top