FileOwnerAttributeView
interface FileOwnerAttributeView : FileAttributeView
java.nio.file.attribute.FileOwnerAttributeView |
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
and setAttribute
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
.
Summary
Public methods | |
---|---|
abstract UserPrincipal! |
getOwner() Read the file owner. |
abstract String! |
name() Returns the name of the attribute view. |
abstract Unit |
setOwner(owner: UserPrincipal!) Updates the file owner. |
Public methods
getOwner
abstract fun getOwner(): UserPrincipal!
Read the file owner.
It is implementation specific if the file owner can be a group
.
Return | |
---|---|
UserPrincipal! |
the file owner |
Exceptions | |
---|---|
java.io.IOException |
if an I/O error occurs |
java.lang.SecurityException |
In the case of the default provider, a security manager is installed, and it denies RuntimePermission ("accessUserInformation") or its checkRead method denies read access to the file. |
name
abstract fun name(): String!
Returns the name of the attribute view. Attribute views of this type have the name "owner"
.
Return | |
---|---|
String! |
the name of the attribute view |
setOwner
abstract fun setOwner(owner: UserPrincipal!): Unit
Updates the file owner.
It is implementation specific if the file owner can be a group
. 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 |
UserPrincipal!: the new file owner |
Exceptions | |
---|---|
java.io.IOException |
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 |
java.lang.SecurityException |
In the case of the default provider, a security manager is installed, and it denies RuntimePermission ("accessUserInformation") or its checkWrite method denies write access to the file. |