Flushing ZipFS

Xueming Shen xueming.shen at oracle.com
Sun Jul 1 10:44:00 PDT 2012

It was debated whether or not the sync() method of the ZipFileSystem 
should be exposed. Currently
the sync() is only invoked when close() is being invoked with the 
assumption that zipfs will only be
used via the java.nio.file API, which currently does not have a 
flush/sync method (flush/sync is more
an implementation details of a file system). We might need to re-address 
this issue if zipFs is being
used by its own in JDK8 (there are couple more issues need to be 
addressed as well).


On 7/1/2012 8:31 AM, Daniel Latrémolière wrote:
> When using JDK7 ZipFS provider, I have seen that the Zip file is not 
> updated even many hours after writing new files in Zip (closing 
> OutputStream of new entries, but not closing Zip instance of 
> FileSystem). When closing application (and particularly Zip 
> FileSystem), the new entries are added to the zip file.
> It seems ZipFS provider has a cache of files and that seem logical, 
> but I don't see a method for flushing this cache (in a valid Zip file 
> would be better). I would have expected to see a method flush() in 
> java.nio.file.FileSystem, but it is not the case. Is there a clean 
> solution (excepted closing and reopening regularly the FileSystem)?
> Thanks.

More information about the nio-dev mailing list