< prev index next >

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

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

*** 39,48 **** --- 39,76 ---- * * <h3>URI Scheme Used to Identify the Zip File System</h3> * * The URI {@link java.net.URI#getScheme scheme} that identifies the ZIP file system is {@code jar}. * + * <h3>Posix Support</h3> + * + * File systems created by the Zip file system provider have a built in support + * for POSIX permissions. It is possible to query a + * {@link java.nio.file.Path Path} object from a Zip file system for the + * attribute {@code storedPermissions}. The value of the attribute + * will be of type + * {@link java.util.Set}&lt;{@link java.nio.file.attribute.PosixFilePermission}&gt;. + * As POSIX permission information is optional in Zip files, the attribute value + * will be {@code null} in case no permission information exists for a Zip entry.<br> + * + * For extended POSIX support, allowing to use + * {@link java.nio.file.attribute.PosixFileAttributeView} and taking advantage + * of {@link java.nio.file.Files#setPosixFilePermissions Files::setPosixFilePermissions} + * or {@link java.nio.file.Files#getPosixFilePermissions Files::getPosixFilePermissions}, + * it is possible to create a Zip file system with the property {@code posix} + * set to {@code true}. + * In that case, certain defaults apply. The owner of a file will be set to a + * {@link java.nio.file.attribute.UserPrincipal} with its name set to the value of + * {@code System.getProperty("user.name")}. The group will be a + * {@link java.nio.file.attribute.GroupPrincipal} with the name "{@code <zipfs_default>}". + * The default {@link java.util.Set} of permissions for cases when no permission data + * is associated with a Zip file entry, will contain + * {@link java.nio.file.attribute.PosixFilePermission#OWNER_READ OWNER_READ}, + * {@link java.nio.file.attribute.PosixFilePermission#OWNER_WRITE OWNER_WRITE} and + * {@link java.nio.file.attribute.PosixFilePermission#GROUP_READ GROUP_READ}. + * It is possible to override the defaults using properties as specified below. + * * <h3>Zip File System Properties</h3> * * The following properties may be specified when creating a Zip * file system: * <p>
*** 77,86 **** --- 105,153 ---- * <td> * The value indicates the encoding scheme for the * names of the entries in the Zip or JAR file. * </td> * </tr> + * <tr> + * <td scope="row">posix</td> + * <td>java.lang.Boolean</td> + * <td>false</td> + * <td> + * If the value is {@code true}, the created Zip file system will support + * the {@link java.nio.file.attribute.PosixFileAttributeView}. + * </td> + * </tr> + * <tr> + * <td scope="row">defaultOwner</td> + * <td>java.nio.file.attribute.UserPrincipal</td> + * <td>A user principal with its name set to the value of System property + * "{@code user.name}"</td> + * <td> + * The value will be the default owner for entries in the Zip + * file system. + * </td> + * </tr> + * <tr> + * <td scope="row">defaultGroup</td> + * <td>java.nio.file.attribute.GroupPrincipal</td> + * <td>A group principal with its name set to "{@code <zipfs_default>}"</td> + * <td> + * The value will be the default group for entries in the Zip + * file system. + * </td> + * </tr> + * <tr> + * <td scope="row">defaultPermissions</td> + * <td>java.util.Set&lt;{@link java.nio.file.attribute.PosixFilePermission}&gt;</td> + * <td>A set of {@link java.nio.file.attribute.PosixFilePermission#OWNER_READ OWNER_READ}, + * {@link java.nio.file.attribute.PosixFilePermission#OWNER_WRITE OWNER_WRITE} and + * {@link java.nio.file.attribute.PosixFilePermission#GROUP_READ GROUP_READ}</td> + * <td> + * The value will be the default Set of permissions for entries in the Zip + * file system. + * </td> + * </tr> * </tbody> * </table> * * <h3>Examples:</h3> *
< prev index next >