src/jdk.zipfs/share/classes/module-info.java
author hannesw
Tue, 10 Sep 2019 15:30:23 +0200
changeset 58071 8a066d872553
parent 57665 bf325b739c8a
child 58467 72ef2c0faf47
permissions -rw-r--r--
8230766: Changed message in IllegalMonitorStateException Reviewed-by: attila, jlaskey
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     1
/*
53715
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
     2
 * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     4
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    10
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    15
 * accompanied this code).
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    16
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    20
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    23
 * questions.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    24
 */
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    25
57665
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    26
import java.nio.file.Files;
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    27
import java.nio.file.LinkOption;
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    28
import java.nio.file.Path;
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    29
import java.nio.file.attribute.FileAttributeView;
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    30
import java.nio.file.attribute.PosixFileAttributes;
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    31
import java.nio.file.attribute.PosixFilePermission;
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    32
import java.nio.file.attribute.PosixFileAttributeView;
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    33
import java.util.Set;
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    34
44417
a431edba1629 8173303: Add module-subgraph images to main platform documentation
mchung
parents: 36511
diff changeset
    35
/**
53715
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
    36
 * Provides the implementation of the Zip file system provider.
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
    37
 * The Zip file system provider treats the contents of a Zip or JAR file as a file system.
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
    38
 *
55129
baad58d0cbfe 8225094: Fix minor HTML issues in jdk.zipfs
jjg
parents: 53715
diff changeset
    39
 * <h2>Accessing a Zip File System</h2>
53715
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
    40
 *
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
    41
 * The {@linkplain java.nio.file.FileSystems FileSystems} {@code newFileSystem}
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
    42
 * static factory methods can be used to:
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
    43
 * <ul>
57665
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    44
 *   <li>Create a Zip file system</li>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    45
 *   <li>Open an existing file as a Zip file system</li>
53715
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
    46
 * </ul>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
    47
 *
57665
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    48
 * <h2>URI Scheme Used to Identify the Zip File System</h2>
53715
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
    49
 *
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
    50
 * The URI {@link java.net.URI#getScheme scheme} that identifies the ZIP file system is {@code jar}.
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
    51
 *
57665
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    52
 * <h2>POSIX file attributes</h2>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    53
 *
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    54
 * A Zip file system supports a file attribute {@link FileAttributeView view}
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    55
 * named "{@code zip}" that defines the following file attribute:
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    56
 *
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    57
 * <blockquote>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    58
 * <table class="striped">
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    59
 * <caption style="display:none">Supported attributes</caption>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    60
 * <thead>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    61
 *   <tr>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    62
 *     <th scope="col">Name</th>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    63
 *     <th scope="col">Type</th>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    64
 *   </tr>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    65
 * </thead>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    66
 * <tbody>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    67
 *   <tr>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    68
 *     <th scope="row">permissions</th>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    69
 *     <td>{@link Set}&lt;{@link PosixFilePermission}&gt;</td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    70
 *   </tr>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    71
 * </tbody>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    72
 * </table>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    73
 * </blockquote>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    74
 *
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    75
 * The "permissions" attribute is the set of access permissions that are optionally
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    76
 * stored for entries in a Zip file. The value of the attribute is {@code null}
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    77
 * for entries that do not have access permissions. Zip file systems do not
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    78
 * enforce access permissions.
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    79
 *
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    80
 * <p> The "permissions" attribute may be read and set using the
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    81
 * {@linkplain Files#getAttribute(Path, String, LinkOption...) Files.getAttribute} and
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    82
 * {@linkplain Files#setAttribute(Path, String, Object, LinkOption...) Files.setAttribute}
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    83
 * methods. The following example uses these methods to read and set the attribute:
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    84
 * <pre> {@code
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    85
 *     Set<PosixFilePermission> perms = Files.getAttribute(entry, "zip:permissions");
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    86
 *     if (perms == null) {
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    87
 *         perms = PosixFilePermissions.fromString("rw-rw-rw-");
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    88
 *         Files.setAttribute(entry, "zip:permissions", perms);
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    89
 *     }
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    90
 * } </pre>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    91
 *
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    92
 * <p> In addition to the "{@code zip}" view, a Zip file system optionally supports
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    93
 * the {@link PosixFileAttributeView} ("{@code posix}").
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    94
 * This view extends the "{@code basic}" view with type safe access to the
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    95
 * {@link PosixFileAttributes#owner() owner}, {@link PosixFileAttributes#group() group-owner},
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    96
 * and {@link PosixFileAttributes#permissions() permissions} attributes. The
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    97
 * "{@code posix}" view is only supported when the Zip file system is created with
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    98
 * the provider property "{@code enablePosixFileAttributes}" set to "{@code true}".
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
    99
 * The following creates a file system with this property and reads the access
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   100
 * permissions of a file:
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   101
 * <pre> {@code
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   102
 *     var env = Map.of("enablePosixFileAttributes", "true");
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   103
 *     try (FileSystem fs = FileSystems.newFileSystem(file, env) {
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   104
 *         Path entry = fs.getPath("entry");
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   105
 *         Set<PosixFilePermission> perms = Files.getPosixFilePermissions(entry);
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   106
 *     }
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   107
 * } </pre>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   108
 *
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   109
 * <p> The file owner and group owner attributes are not persisted, meaning they are
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   110
 * not stored in the zip file. The "{@code defaultOwner}" and "{@code defaultGroup}"
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   111
 * provider properties (listed below) can be used to configure the default values
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   112
 * for these attributes. If these properties are not set then the file owner
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   113
 * defaults to the owner of the zip file, and the group owner defaults to the
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   114
 * zip file's group owner (or the file owner on platforms that don't support a
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   115
 * group owner).
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   116
 *
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   117
 * <p> The "{@code permissions}" attribute is not optional in the "{@code posix}"
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   118
 * view so a default set of permissions are used for entries that do not have
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   119
 * access permissions stored in the Zip file. The default set of permissions
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   120
 * are
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   121
 * <ul>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   122
 *   <li>{@link PosixFilePermission#OWNER_READ OWNER_READ}</li>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   123
 *   <li>{@link PosixFilePermission#OWNER_WRITE OWNER_WRITE}</li>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   124
 *   <li>{@link PosixFilePermission#GROUP_READ GROUP_READ}</li>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   125
 * </ul>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   126
 * The default permissions can be configured with the "{@code defaultPermissions}"
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   127
 * property described below.
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   128
 *
55129
baad58d0cbfe 8225094: Fix minor HTML issues in jdk.zipfs
jjg
parents: 53715
diff changeset
   129
 * <h2>Zip File System Properties</h2>
53715
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   130
 *
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   131
 * The following properties may be specified when creating a Zip
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   132
 * file system:
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   133
 * <table class="striped">
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   134
 * <caption style="display:none">
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   135
 *     Configurable properties that may be specified when creating
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   136
 *     a new Zip file system
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   137
 * </caption>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   138
 * <thead>
57665
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   139
 *   <tr>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   140
 *     <th scope="col">Property Name</th>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   141
 *     <th scope="col">Data Type</th>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   142
 *     <th scope="col">Default Value</th>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   143
 *     <th scope="col">Description</th>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   144
 *   </tr>
53715
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   145
 * </thead>
44417
a431edba1629 8173303: Add module-subgraph images to main platform documentation
mchung
parents: 36511
diff changeset
   146
 *
53715
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   147
 * <tbody>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   148
 * <tr>
55470
97c75e545302 8226592: Fix HTML in table for jdk.zipfs module-info
jjg
parents: 55129
diff changeset
   149
 *   <th scope="row">create</th>
53715
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   150
 *   <td>java.lang.String</td>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   151
 *   <td>false</td>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   152
 *   <td>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   153
 *       If the value is {@code true}, the Zip file system provider
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   154
 *       creates a new Zip or JAR file if it does not exist.
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   155
 *   </td>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   156
 * </tr>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   157
 * <tr>
55470
97c75e545302 8226592: Fix HTML in table for jdk.zipfs module-info
jjg
parents: 55129
diff changeset
   158
 *   <th scope="row">encoding</th>
53715
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   159
 *   <td>java.lang.String</td>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   160
 *   <td>UTF-8</td>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   161
 *   <td>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   162
 *       The value indicates the encoding scheme for the
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   163
 *       names of the entries in the Zip or JAR file.
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   164
 *   </td>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   165
 * </tr>
57665
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   166
 * <tr>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   167
 *   <td scope="row">enablePosixFileAttributes</td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   168
 *   <td>java.lang.String</td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   169
 *   <td>false</td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   170
 *   <td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   171
 *       If the value is {@code true}, the Zip file system will support
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   172
 *       the {@link java.nio.file.attribute.PosixFileAttributeView PosixFileAttributeView}.
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   173
 *   </td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   174
 * </tr>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   175
 * <tr>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   176
 *   <td scope="row">defaultOwner</td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   177
 *   <td>{@link java.nio.file.attribute.UserPrincipal UserPrincipal}<br> or java.lang.String</td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   178
 *   <td>null/unset</td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   179
 *   <td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   180
 *       Override the default owner for entries in the Zip file system.<br>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   181
 *       The value can be a UserPrincipal or a String value that is used as the UserPrincipal's name.
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   182
 *   </td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   183
 * </tr>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   184
 * <tr>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   185
 *   <td scope="row">defaultGroup</td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   186
 *   <td>{@link java.nio.file.attribute.GroupPrincipal GroupPrincipal}<br> or java.lang.String</td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   187
 *   <td>null/unset</td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   188
 *   <td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   189
 *       Override the the default group for entries in the Zip file system.<br>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   190
 *       The value can be a GroupPrincipal or a String value that is used as the GroupPrincipal's name.
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   191
 *   </td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   192
 * </tr>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   193
 * <tr>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   194
 *   <td scope="row">defaultPermissions</td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   195
 *   <td>{@link java.util.Set Set}&lt;{@link java.nio.file.attribute.PosixFilePermission PosixFilePermission}&gt;<br>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   196
 *       or java.lang.String</td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   197
 *   <td>null/unset</td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   198
 *   <td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   199
 *       Override the default Set of permissions for entries in the Zip file system.<br>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   200
 *       The value can be a {@link java.util.Set Set}&lt;{@link java.nio.file.attribute.PosixFilePermission PosixFilePermission}&gt; or<br>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   201
 *       a String that is parsed by {@link java.nio.file.attribute.PosixFilePermissions#fromString PosixFilePermissions::fromString}
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   202
 *   </td>
bf325b739c8a 8213031: (zipfs) Add support for POSIX file permissions
clanger
parents: 55470
diff changeset
   203
 * </tr>
53715
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   204
 * </tbody>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   205
 * </table>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   206
 *
55129
baad58d0cbfe 8225094: Fix minor HTML issues in jdk.zipfs
jjg
parents: 53715
diff changeset
   207
 * <h2>Examples:</h2>
45528
1e8c2f062ad3 8181639: Add tool and services information to module summary
mchung
parents: 44417
diff changeset
   208
 *
53715
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   209
 * Construct a new Zip file system that is identified by a URI.  If the Zip file does not exist,
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   210
 * it will be created:
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   211
 * <pre>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   212
 * {@code
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   213
 *
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   214
 *     URI uri = URI.create("jar:file:/home/luckydog/tennisTeam.zip");
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   215
 *     Map<String, String> env = Map.of("create", "true");
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   216
 *     FileSystem zipfs = FileSystems.newFileSystem(uri, env);
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   217
 * }
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   218
 * </pre>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   219
 *
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   220
 * Construct a new Zip file system that is identified by specifying a path
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   221
 * and using automatic file type detection. Iterate from the root of the JAR displaying each
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   222
 * found entry:
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   223
 * <pre>
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   224
 * {@code
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   225
 *
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   226
 *     FileSystem zipfs = FileSystems.newFileSystem(Path.of("helloworld.jar"), null);
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   227
 *     Path rootDir = zipfs.getPath("/");
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   228
 *     Files.walk(rootDir)
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   229
 *            .forEach(System.out::println);
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   230
 * }
6c96d42ec3e7 8182117: Document Zip File System Properties
lancea
parents: 47216
diff changeset
   231
 * </pre>
45528
1e8c2f062ad3 8181639: Add tool and services information to module summary
mchung
parents: 44417
diff changeset
   232
 * @provides java.nio.file.spi.FileSystemProvider
44417
a431edba1629 8173303: Add module-subgraph images to main platform documentation
mchung
parents: 36511
diff changeset
   233
 * @moduleGraph
a431edba1629 8173303: Add module-subgraph images to main platform documentation
mchung
parents: 36511
diff changeset
   234
 * @since 9
a431edba1629 8173303: Add module-subgraph images to main platform documentation
mchung
parents: 36511
diff changeset
   235
 */
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   236
module jdk.zipfs {
45654
5ff2edfa03fc 8182416: Clean up module-info.java like move requires transitive adjacent to exports
mchung
parents: 45528
diff changeset
   237
    provides java.nio.file.spi.FileSystemProvider with
5ff2edfa03fc 8182416: Clean up module-info.java like move requires transitive adjacent to exports
mchung
parents: 45528
diff changeset
   238
        jdk.nio.zipfs.ZipFileSystemProvider;
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   239
}