< prev index next >

src/jdk.zipfs/share/classes/module-info.java

Print this page
rev 54189 : 8213031: (zipfs) Add support for POSIX file permissions


  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


  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>Support for POSIX file permissions</h3>
  45  *
  46  * File systems created by the Zip file system provider have a built in support
  47  * for POSIX permissions. It is possible to query a
  48  * {@link java.nio.file.Path Path} object from a Zip file system for the
  49  * attribute {@code storedPermissions}. The value of the attribute
  50  * will be of type
  51  * {@link java.util.Set}&lt;{@link java.nio.file.attribute.PosixFilePermission}&gt;.
  52  * As POSIX permission information is optional in Zip files, the attribute value
  53  * will be {@code null} in case no permission information exists for a Zip entry.<br>
  54  *
  55  * For extended POSIX support, allowing to use
  56  * {@link java.nio.file.attribute.PosixFileAttributeView} and taking advantage
  57  * of {@link java.nio.file.Files#setPosixFilePermissions Files::setPosixFilePermissions}
  58  * or {@link java.nio.file.Files#getPosixFilePermissions Files::getPosixFilePermissions},
  59  * it is possible to create a Zip file system with the property {@code posix}
  60  * set to {@code true}.
  61  * In that case, certain defaults apply. The owner of a file will be set to a
  62  * {@link java.nio.file.attribute.UserPrincipal} with its name set to the value of
  63  * {@code System.getProperty("user.name")}. The group will be a
  64  * {@link java.nio.file.attribute.GroupPrincipal} with the name "{@code <zipfs_default>}".
  65  * The default {@link java.util.Set} of permissions for cases when no permission data
  66  * is associated with a Zip file entry, will contain
  67  * {@link java.nio.file.attribute.PosixFilePermission#OWNER_READ OWNER_READ},
  68  * {@link java.nio.file.attribute.PosixFilePermission#OWNER_WRITE OWNER_WRITE} and
  69  * {@link java.nio.file.attribute.PosixFilePermission#GROUP_READ GROUP_READ}.
  70  * It is possible to override the defaults using properties as specified below.
  71  *
  72  * <h3>Zip File System Properties</h3>
  73  *
  74  * The following properties may be specified when creating a Zip
  75  * file system:
  76  * <p>
  77  * <table class="striped">
  78  * <caption style="display:none">
  79  *     Configurable properties that may be specified when creating
  80  *     a new Zip file system
  81  * </caption>
  82  * <thead>
  83  * <tr>
  84  * <th scope="col">Property Name</th>
  85  * <th scope="col">Data Type</th>
  86  * <th scope="col">Default Value</th>
  87  * <th scope="col">Description</th>
  88  * </tr>
  89  * </thead>
  90  *
  91  * <tbody>
  92  * <tr>
  93  *   <td scope="row">create</td>
  94  *   <td>java.lang.String</td>
  95  *   <td>false</td>
  96  *   <td>
  97  *       If the value is {@code true}, the Zip file system provider
  98  *       creates a new Zip or JAR file if it does not exist.
  99  *   </td>
 100  * </tr>
 101  * <tr>
 102  *   <td scope="row">encoding</td>
 103  *   <td>java.lang.String</td>
 104  *   <td>UTF-8</td>
 105  *   <td>
 106  *       The value indicates the encoding scheme for the
 107  *       names of the entries in the Zip or JAR file.
 108  *   </td>
 109  * </tr>
 110  * <tr>
 111  *   <td scope="row">enablePosixFileAttributes</td>
 112  *   <td>java.lang.String</td>
 113  *   <td>false</td>
 114  *   <td>
 115  *       If the value is {@code true}, the created Zip file system will support
 116  *       the {@link java.nio.file.attribute.PosixFileAttributeView}.
 117  *   </td>
 118  * </tr>
 119  * <tr>
 120  *   <td scope="row">defaultOwner</td>
 121  *   <td>java.nio.file.attribute.UserPrincipal</td>
 122  *   <td>A user principal with its name set to the value of System property
 123  *       "{@code user.name}"</td>
 124  *   <td>
 125  *       The value will be the default owner for entries in the Zip
 126  *       file system.
 127  *   </td>
 128  * </tr>
 129  * <tr>
 130  *   <td scope="row">defaultGroup</td>
 131  *   <td>java.nio.file.attribute.GroupPrincipal</td>
 132  *   <td>A group principal with its name set to "{@code <zipfs_default>}"</td>
 133  *   <td>
 134  *       The value will be the default group for entries in the Zip
 135  *       file system.
 136  *   </td>
 137  * </tr>
 138  * <tr>
 139  *   <td scope="row">defaultPermissions</td>
 140  *   <td>java.util.Set&lt;{@link java.nio.file.attribute.PosixFilePermission}&gt;</td>
 141  *   <td>A set of {@link java.nio.file.attribute.PosixFilePermission#OWNER_READ OWNER_READ},
 142  *       {@link java.nio.file.attribute.PosixFilePermission#OWNER_WRITE OWNER_WRITE} and
 143  *       {@link java.nio.file.attribute.PosixFilePermission#GROUP_READ GROUP_READ}</td>
 144  *   <td>
 145  *       The value will be the default Set of permissions for entries in the Zip
 146  *       file system.
 147  *   </td>
 148  * </tr>
 149  * </tbody>
 150  * </table>
 151  *
 152  * <h3>Examples:</h3>
 153  *
 154  * Construct a new Zip file system that is identified by a URI.  If the Zip file does not exist,
 155  * it will be created:
 156  * <pre>
 157  * {@code
 158  *
 159  *     URI uri = URI.create("jar:file:/home/luckydog/tennisTeam.zip");
 160  *     Map<String, String> env = Map.of("create", "true");
 161  *     FileSystem zipfs = FileSystems.newFileSystem(uri, env);
 162  * }
 163  * </pre>
 164  *
 165  * Construct a new Zip file system that is identified by specifying a path
 166  * and using automatic file type detection. Iterate from the root of the JAR displaying each
< prev index next >