ZipFileSystem doesn't obey spec of newOutputStream()
Colin Decker
cgdecker at google.com
Tue Feb 11 13:21:11 PST 2014
The spec states that newOutputStream(), given no OpenOptions, behaves as if
CREATE, WRITE and TRUNCATE_EXISTING were provided. ZipFileSystem (or
ZipPath more specifically) instead uses CREATE_NEW and WRITE. Is there some
reason for this?
Another question: ZipFileSystemProvider's newFileSystem(Path, Map) method
throws UnsupportedOperationException unless the Path is a default file
system path. I can't really see a good reason for this. Certainly, there
could be some file systems it doesn't work well with, but other file
systems it may work fine with. It seems to work more or less perfectly with
my in-memory file system under JDK8. I was actually able to work around
this behavior of ZipFileSystemProvider by having my own FileSystemProvider
implementation return a ZipFileSystem from its newFileSystem(Path, Map)
method, by appending "jar:" to the Path parameter's URI and calling
newFileSystem(URI, Map). It seems sort of wrong, but it works.
--
Colin Decker | Software Engineer | cgdecker at google.com | Java Core
Libraries Team
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20140211/da3b9d1d/attachment.html
More information about the nio-dev
mailing list