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 * 30 * <h2>Accessing a Zip File System</h2> 31 * 32 * The {@linkplain java.nio.file.FileSystems FileSystems} {@code newFileSystem} 33 * static factory methods can be used to: 34 * <ul> 35 * <li>Create a Zip file system</li> 36 * <li>Open an existing file as a Zip file system</li> 37 * </ul> 38 * 39 * <h3>URI Scheme Used to Identify the Zip File System</h3> 40 * 41 * The URI {@link java.net.URI#getScheme scheme} that identifies the ZIP file system is {@code jar}. 42 * 43 * <h2>Zip File System Properties</h2> 44 * 45 * The following properties may be specified when creating a Zip 46 * file system: 47 * <table class="striped"> 48 * <caption style="display:none"> 49 * Configurable properties that may be specified when creating 50 * a new Zip file system 51 * </caption> 52 * <thead> 53 * <tr> 54 * <th scope="col">Property Name</th> 55 * <th scope="col">Data Type</th> 56 * <th scope="col">Default Value</th> 57 * <th scope="col">Description</th> 58 * </tr> 59 * </thead> 60 * 61 * <tbody> 62 * <tr> 63 * <td scope="row">create</td> 64 * <td>java.lang.String</td> 65 * <td>false</td> 66 * <td> 67 * If the value is {@code true}, the Zip file system provider 68 * creates a new Zip or JAR file if it does not exist. 69 * </td> 70 * </tr> 71 * <tr> 72 * <td scope="row">encoding</td> 73 * <td>java.lang.String</td> 74 * <td>UTF-8</td> 75 * <td> 76 * The value indicates the encoding scheme for the 77 * names of the entries in the Zip or JAR file. 78 * </td> 79 * </tr> 80 * </tbody> 81 * </table> 82 * 83 * <h2>Examples:</h2> 84 * 85 * Construct a new Zip file system that is identified by a URI. If the Zip file does not exist, 86 * it will be created: 87 * <pre> 88 * {@code 89 * 90 * URI uri = URI.create("jar:file:/home/luckydog/tennisTeam.zip"); 91 * Map<String, String> env = Map.of("create", "true"); 92 * FileSystem zipfs = FileSystems.newFileSystem(uri, env); 93 * } 94 * </pre> 95 * 96 * Construct a new Zip file system that is identified by specifying a path 97 * and using automatic file type detection. Iterate from the root of the JAR displaying each 98 * found entry: 99 * <pre> 100 * {@code 101 * 102 * FileSystem zipfs = FileSystems.newFileSystem(Path.of("helloworld.jar"), null); 103 * Path rootDir = zipfs.getPath("/"); 104 * Files.walk(rootDir) 105 * .forEach(System.out::println); 106 * } 107 * </pre> 108 * @provides java.nio.file.spi.FileSystemProvider 109 * @moduleGraph 110 * @since 9 111 */ 112 module jdk.zipfs { 113 provides java.nio.file.spi.FileSystemProvider with 114 jdk.nio.zipfs.ZipFileSystemProvider; 115 }