zipfs - create = true should create parent dirs too?
Alan Bateman
Alan.Bateman at oracle.com
Fri Nov 22 12:16:28 UTC 2019
On 22/11/2019 12:10, Jaikiran Pai wrote:
> The ZipFileSystemProvider states in this doc[1] that the "create"
> property with a value "true", creates the zip file if it's not present,
> when FileSystems.newFileSystem the API is used. However, it doesn't say
> anything about the parent directories of the Path that's passed as the
> zip file path. Imagine something like /tmp/non-existent/newzip.jar as
> the Path that gets passed to the FileSystems.newFileSystem with "create"
> = "true". What's the expected semantics here for zipfs? Should it be
> expected to even create the non-existent parent dir(s)?
>
> Right now, the implementation fails with a NoSuchFileException due to
> the missing parent dir.
It should only attempt to create the zip file, not the directories.
>
> On a related note, is there any public documentation of zipfs and its
> properties post Java 8 release? I couldn't find anything in the javadocs
> or other places for this.
>
The documentation is in the the jdk.zipfs module description, which of
course didn't exist in JDK 8. The docs have been expanding and
improvement in recent time, here's the latest for jdk-14+24:
https://download.java.net/java/early_access/jdk14/docs/api/jdk.zipfs/module-summary.html
-Alan
More information about the nio-dev
mailing list