FileOwnerAttributeView (Java Platform SE 8 ) (original) (raw)
- All Superinterfaces:
AttributeView, FileAttributeView
All Known Subinterfaces:
AclFileAttributeView, PosixFileAttributeView
public interface FileOwnerAttributeView
extends FileAttributeView
A file attribute view that supports reading or updating the owner of a file. This file attribute view is intended for file system implementations that support a file attribute that represents an identity that is the owner of the file. Often the owner of a file is the identity of the entity that created the file.
The getOwner or setOwner methods may be used to read or update the owner of the file.
The getAttribute andsetAttribute methods may also be used to read or update the owner. In that case, the owner attribute is identified by the name "owner"
, and the value of the attribute is a UserPrincipal.
Since:
1.7
Method Summary
All Methods Instance Methods Abstract Methods
Modifier and Type Method Description UserPrincipal getOwner() Read the file owner. String name() Returns the name of the attribute view. void setOwner(UserPrincipal owner) Updates the file owner. Method Detail
* #### name [String](../../../../java/lang/String.html "class in java.lang") name() Returns the name of the attribute view. Attribute views of this type have the name `"owner"`. Specified by: `[name](../../../../java/nio/file/attribute/AttributeView.html#name--)` in interface `[AttributeView](../../../../java/nio/file/attribute/AttributeView.html "interface in java.nio.file.attribute")` Returns: the name of the attribute view * #### getOwner [UserPrincipal](../../../../java/nio/file/attribute/UserPrincipal.html "interface in java.nio.file.attribute") getOwner() throws [IOException](../../../../java/io/IOException.html "class in java.io") Read the file owner. It it implementation specific if the file owner can be a [group](../../../../java/nio/file/attribute/GroupPrincipal.html "interface in java.nio.file.attribute"). Returns: the file owner Throws: `[IOException](../../../../java/io/IOException.html "class in java.io")` \- if an I/O error occurs `[SecurityException](../../../../java/lang/SecurityException.html "class in java.lang")` \- In the case of the default provider, a security manager is installed, and it denies [RuntimePermission](../../../../java/lang/RuntimePermission.html "class in java.lang")("accessUserInformation") or its[checkRead](../../../../java/lang/SecurityManager.html#checkRead-java.lang.String-) method denies read access to the file. * #### setOwner void setOwner([UserPrincipal](../../../../java/nio/file/attribute/UserPrincipal.html "interface in java.nio.file.attribute") owner) throws [IOException](../../../../java/io/IOException.html "class in java.io") Updates the file owner. It it implementation specific if the file owner can be a [group](../../../../java/nio/file/attribute/GroupPrincipal.html "interface in java.nio.file.attribute"). To ensure consistent and correct behavior across platforms it is recommended that this method should only be used to set the file owner to a user principal that is not a group. Parameters: `owner` \- the new file owner Throws: `[IOException](../../../../java/io/IOException.html "class in java.io")` \- if an I/O error occurs, or the `owner` parameter is a group and this implementation does not support setting the owner to a group `[SecurityException](../../../../java/lang/SecurityException.html "class in java.lang")` \- In the case of the default provider, a security manager is installed, and it denies [RuntimePermission](../../../../java/lang/RuntimePermission.html "class in java.lang")("accessUserInformation") or its[checkWrite](../../../../java/lang/SecurityManager.html#checkWrite-java.lang.String-) method denies write access to the file.
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.