-
- 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
orsetOwner
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 aUserPrincipal
.- Since:
- 1.7
-
-
Method Summary
Methods Modifier and Type Method and 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 name()
Returns the name of the attribute view. Attribute views of this type have the name"owner"
.- Specified by:
name
in interfaceAttributeView
-
getOwner
UserPrincipal getOwner() throws IOException
Read the file owner.It it implementation specific if the file owner can be a
group
.- Returns:
- the file owner
- Throws:
IOException
- if an I/O error occursSecurityException
- In the case of the default provider, a security manager is installed, and it deniesRuntimePermission
("accessUserInformation") or itscheckRead
method denies read access to the file.
-
setOwner
void setOwner(UserPrincipal owner) throws IOException
Updates the file owner.It it 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
- the new file owner- Throws:
IOException
- if an I/O error occurs, or theowner
parameter is a group and this implementation does not support setting the owner to a groupSecurityException
- In the case of the default provider, a security manager is installed, and it deniesRuntimePermission
("accessUserInformation") or itscheckWrite
method denies write access to the file.
-
-
Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-java/nio/file/attribute/fileownerattributeview.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.