1 /*
   2  * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /**
  27  * Provides the implementation of the Zip file system provider.
  28  * The Zip file system provider treats the contents of a Zip or JAR file as a file system.
  29  * <p>
  30  *
  31  * <h3>Accessing a Zip File System</h3>
  32  *
  33  * The {@linkplain java.nio.file.FileSystems FileSystems} {@code newFileSystem}
  34  * static factory methods can be used to:
  35  * <ul>
  36  *     <li>Create a Zip file system</li>
  37  *     <li>Open an existing file as a Zip file system</li>
  38  * </ul>
  39  *
  40  * <h3>URI Scheme Used to Identify the Zip File System</h3>
  41  *
  42  * The URI {@link java.net.URI#getScheme scheme} that identifies the ZIP file system is {@code jar}.
  43  *
  44  * <h3>Zip File System Properties</h3>
  45  *
  46  * The following properties may be specified when creating a Zip
  47  * file system:
  48  * <p>
  49  * <table class="striped">
  50  * <caption style="display:none">
  51  *     Configurable properties that may be specified when creating
  52  *     a new Zip file system
  53  * </caption>
  54  * <thead>
  55  * <tr>
  56  * <th scope="col">Property Name</th>
  57  * <th scope="col">Data Type</th>
  58  * <th scope="col">Default Value</th>
  59  * <th scope="col">Description</th>
  60  * </tr>
  61  * </thead>
  62  *
  63  * <tbody>
  64  * <tr>
  65  *   <td scope="row">create</td>
  66  *   <td>java.lang.String</td>
  67  *   <td>false</td>
  68  *   <td>
  69  *       If the value is {@code true}, the Zip file system provider
  70  *       creates a new Zip or JAR file if it does not exist.
  71  *   </td>
  72  * </tr>
  73  * <tr>
  74  *   <td scope="row">encoding</td>
  75  *   <td>java.lang.String</td>
  76  *   <td>UTF-8</td>
  77  *   <td>
  78  *       The value indicates the encoding scheme for the
  79  *       names of the entries in the Zip or JAR file.
  80  *   </td>
  81  * </tr>
  82  * </tbody>
  83  * </table>
  84  *
  85  * <h3>Examples:</h3>
  86  *
  87  * Construct a new Zip file system that is identified by a URI.  If the Zip file does not exist,
  88  * it will be created:
  89  * <pre>
  90  * {@code
  91  *
  92  *     URI uri = URI.create("jar:file:/home/luckydog/tennisTeam.zip");
  93  *     Map<String, String> env = Map.of("create", "true");
  94  *     FileSystem zipfs = FileSystems.newFileSystem(uri, env);
  95  * }
  96  * </pre>
  97  *
  98  * Construct a new Zip file system that is identified by specifying a path
  99  * and using automatic file type detection. Iterate from the root of the JAR displaying each
 100  * found entry:
 101  * <pre>
 102  * {@code
 103  *
 104  *     FileSystem zipfs = FileSystems.newFileSystem(Path.of("helloworld.jar"), null);
 105  *     Path rootDir = zipfs.getPath("/");
 106  *     Files.walk(rootDir)
 107  *            .forEach(System.out::println);
 108  * }
 109  * </pre>
 110  * @provides java.nio.file.spi.FileSystemProvider
 111  * @moduleGraph
 112  * @since 9
 113  */
 114 module jdk.zipfs {
 115     provides java.nio.file.spi.FileSystemProvider with
 116         jdk.nio.zipfs.ZipFileSystemProvider;
 117 }