RFR 8182117 : Document Zip File System Properties

Langer, Christoph christoph.langer at sap.com
Tue Feb 5 16:22:13 UTC 2019


Hi Lance, Alan,

Overall looks good to me.

> 
> A few comments
> 
> >
> > + * The Zip file system provider treats a Zip or JAR file as a file system
> > + * providing the ability to manipulate its contents.
> It might be a bit clearer to reduce this to: "The Zip file system
> provider treats the contents of a Zip or JAR file as a file system".

+1

> >    *
> > + * The {@linkplain java.nio.file.FileSystems FileSystems} {@code
> newFileSystem}
> > + * static factory methods can be used to create a new Zip file system or to
> > + * obtain a reference to an existing Zip file system.
> or "can be used to create a zip file system or open an existing file as
> a zip file system".

Here I think Lance's point is what would happen when a FileSystem instance for a particular zip file would already exist and a call to newFileSystem would throw a FileSystemAlreadyExistsException. In that case you need to call getFileSystem. So maybe this sentence should be reworked to cover everything?

> > + *
> > + *     FileSystem zipfs = FileSystems.newFileSystem(
> > + *            Paths.get("tennisteam.jar"), null);
> You can change this to use Path.of, also might be nice to remove the
> line break so it's all on one line.
> 
> > + *     Files.walk(zipfs.getPath("/"))
> > + *            .forEach(System.out::println);
> >
> For clarity it might be better to create a variable, say top, for the
> root directory of the zip file system. The main thing that the reader
> needs to understand is that the file system is the factory to create
> paths to files in that file system.

+1

I'm also wondering, whether we should mention how the FileSystemProvider instance can be resolved (e.g. iterating FileSystemProvider.installedProviders(), checking for scheme "jar")? Not quite sure...

Best regards
Christoph



More information about the core-libs-dev mailing list