jdk/src/share/demo/nio/zipfs/README.txt
author goetz
Thu, 21 Nov 2013 18:29:34 -0800
changeset 22852 1063026e8cee
parent 8165 b67d8b1f4e46
permissions -rw-r--r--
8028471: PPC64 (part 215): opto: Extend ImplicitNullCheck optimization. Summary: Fixed Implicit NULL check optimization for AIX, where the page at address '0' is only write-protected. Reviewed-by: kvn

ZipFileSystem is a file system provider that treats the contents of a zip or
JAR file as a java.nio.file.FileSystem.

The factory methods defined by the java.nio.file.FileSystems class can be
used to create a FileSystem, eg:

   // use file type detection
   Path jarfile = Paths.get("foo.jar");
   FileSystem fs = FileSystems.newFileSystem(jarfile, null);

-or

   // locate file system by the legacy JAR URL syntax
   Map<String,?> env = Collections.emptyMap();
   URI uri = URI.create("jar:file:/mydir/foo.jar");
   FileSystem fs = FileSystems.newFileSystem(uri, env);

Once a FileSystem is created then classes in the java.nio.file package
can be used to access files in the zip/JAR file, eg:

   Path mf = fs.getPath("/META-INF/MANIFEST.MF");
   InputStream in = mf.newInputStream();

See Demo.java for more interesting usages.