77 * // get view
78 * AclFileAttributeView view = Files.getFileAttributeView(file, AclFileAttributeView.class);
79 *
80 * // create ACE to give "joe" read access
81 * AclEntry entry = AclEntry.newBuilder()
82 * .setType(AclEntryType.ALLOW)
83 * .setPrincipal(joe)
84 * .setPermissions(AclEntryPermission.READ_DATA, AclEntryPermission.READ_ATTRIBUTES)
85 * .build();
86 *
87 * // read ACL, insert ACE, re-write ACL
88 * List<AclEntry> acl = view.getAcl();
89 * acl.add(0, entry); // insert before any DENY entries
90 * view.setAcl(acl);
91 * </pre>
92 *
93 * <h2> Dynamic Access </h2>
94 * <p> Where dynamic access to file attributes is required, the attributes
95 * supported by this attribute view are as follows:
96 * <blockquote>
97 * <table border="1" cellpadding="8" summary="Supported attributes">
98 * <tr>
99 * <th> Name </th>
100 * <th> Type </th>
101 * </tr>
102 * <tr>
103 * <td> "acl" </td>
104 * <td> {@link List}<{@link AclEntry}> </td>
105 * </tr>
106 * <tr>
107 * <td> "owner" </td>
108 * <td> {@link UserPrincipal} </td>
109 * </tr>
110 * </table>
111 * </blockquote>
112 *
113 * <p> The {@link Files#getAttribute getAttribute} method may be used to read
114 * the ACL or owner attributes as if by invoking the {@link #getAcl getAcl} or
115 * {@link #getOwner getOwner} methods.
116 *
117 * <p> The {@link Files#setAttribute setAttribute} method may be used to
118 * update the ACL or owner attributes as if by invoking the {@link #setAcl setAcl}
119 * or {@link #setOwner setOwner} methods.
120 *
121 * <h2> Setting the ACL when creating a file </h2>
122 *
123 * <p> Implementations supporting this attribute view may also support setting
124 * the initial ACL when creating a file or directory. The initial ACL
125 * may be provided to methods such as {@link Files#createFile createFile} or {@link
126 * Files#createDirectory createDirectory} as an {@link FileAttribute} with {@link
127 * FileAttribute#name name} {@code "acl:acl"} and a {@link FileAttribute#value
128 * value} that is the list of {@code AclEntry} objects.
129 *
|
77 * // get view
78 * AclFileAttributeView view = Files.getFileAttributeView(file, AclFileAttributeView.class);
79 *
80 * // create ACE to give "joe" read access
81 * AclEntry entry = AclEntry.newBuilder()
82 * .setType(AclEntryType.ALLOW)
83 * .setPrincipal(joe)
84 * .setPermissions(AclEntryPermission.READ_DATA, AclEntryPermission.READ_ATTRIBUTES)
85 * .build();
86 *
87 * // read ACL, insert ACE, re-write ACL
88 * List<AclEntry> acl = view.getAcl();
89 * acl.add(0, entry); // insert before any DENY entries
90 * view.setAcl(acl);
91 * </pre>
92 *
93 * <h2> Dynamic Access </h2>
94 * <p> Where dynamic access to file attributes is required, the attributes
95 * supported by this attribute view are as follows:
96 * <blockquote>
97 * <table class="striped">
98 * <caption style="display:none">Supported attributes</caption>
99 * <thead>
100 * <tr>
101 * <th> Name </th>
102 * <th> Type </th>
103 * </tr>
104 * </thead>
105 * <tbody>
106 * <tr>
107 * <td> "acl" </td>
108 * <td> {@link List}<{@link AclEntry}> </td>
109 * </tr>
110 * <tr>
111 * <td> "owner" </td>
112 * <td> {@link UserPrincipal} </td>
113 * </tr>
114 * </tbody>
115 * </table>
116 * </blockquote>
117 *
118 * <p> The {@link Files#getAttribute getAttribute} method may be used to read
119 * the ACL or owner attributes as if by invoking the {@link #getAcl getAcl} or
120 * {@link #getOwner getOwner} methods.
121 *
122 * <p> The {@link Files#setAttribute setAttribute} method may be used to
123 * update the ACL or owner attributes as if by invoking the {@link #setAcl setAcl}
124 * or {@link #setOwner setOwner} methods.
125 *
126 * <h2> Setting the ACL when creating a file </h2>
127 *
128 * <p> Implementations supporting this attribute view may also support setting
129 * the initial ACL when creating a file or directory. The initial ACL
130 * may be provided to methods such as {@link Files#createFile createFile} or {@link
131 * Files#createDirectory createDirectory} as an {@link FileAttribute} with {@link
132 * FileAttribute#name name} {@code "acl:acl"} and a {@link FileAttribute#value
133 * value} that is the list of {@code AclEntry} objects.
134 *
|