Stay organized with collections
Save and categorize content based on your preferences.
FileOwnerAttributeView
interface FileOwnerAttributeView : FileAttributeView
Known Direct Subclasses
AclFileAttributeView |
A file attribute view that supports reading or updating a file's Access Control Lists (ACL) or file owner attributes.
|
PosixFileAttributeView |
A file attribute view that provides a view of the file attributes commonly associated with files on file systems used by operating systems that implement the Portable Operating System Interface (POSIX) family of standards.
|
|
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! |
Read the file owner.
|
abstract String! |
Returns the name of the attribute view.
|
abstract Unit |
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
.
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.
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. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# FileOwnerAttributeView\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nFileOwnerAttributeView\n======================\n\n```\ninterface FileOwnerAttributeView : FileAttributeView\n```\n\n|-----------------------------------------------------|\n| [java.nio.file.attribute.FileOwnerAttributeView](#) |\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [AclFileAttributeView](/reference/kotlin/java/nio/file/attribute/AclFileAttributeView), [PosixFileAttributeView](/reference/kotlin/java/nio/file/attribute/PosixFileAttributeView) |--------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [AclFileAttributeView](/reference/kotlin/java/nio/file/attribute/AclFileAttributeView) | A file attribute view that supports reading or updating a file's Access Control Lists (ACL) or file owner attributes. | | [PosixFileAttributeView](/reference/kotlin/java/nio/file/attribute/PosixFileAttributeView) | A file attribute view that provides a view of the file attributes commonly associated with files on file systems used by operating systems that implement the Portable Operating System Interface (POSIX) family of standards. | |\n\nA 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.\n\nThe [getOwner](#getOwner()) or [setOwner](#setOwner(java.nio.file.attribute.UserPrincipal)) methods may be used to read or update the owner of the file.\n\nThe [getAttribute](../Files.html#getAttribute(java.nio.file.Path,%20kotlin.String,%20java.nio.file.LinkOption)) and [setAttribute](../Files.html#setAttribute(java.nio.file.Path,%20kotlin.String,%20kotlin.Any,%20java.nio.file.LinkOption)) 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](/reference/kotlin/java/nio/file/attribute/UserPrincipal).\n\nSummary\n-------\n\n| Public methods ||\n|--------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [UserPrincipal](/reference/kotlin/java/nio/file/attribute/UserPrincipal)! | [getOwner](#getOwner())`()` Read the file owner. |\n| abstract [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [name](#name())`()` Returns the name of the attribute view. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setOwner](#setOwner(java.nio.file.attribute.UserPrincipal))`(`owner:` `[UserPrincipal](/reference/kotlin/java/nio/file/attribute/UserPrincipal)!`)` Updates the file owner. |\n\nPublic methods\n--------------\n\n### getOwner\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getOwner(): UserPrincipal!\n```\n\nRead the file owner.\n\nIt is implementation specific if the file owner can be a [group](/reference/kotlin/java/nio/file/attribute/GroupPrincipal).\n\n| Return ||\n|---------------------------------------------------------------------------|----------------|\n| [UserPrincipal](/reference/kotlin/java/nio/file/attribute/UserPrincipal)! | the file owner |\n\n| Exceptions ||\n|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `java.io.IOException` | if an I/O error occurs |\n| `java.lang.SecurityException` | In the case of the default provider, a security manager is installed, and it denies [RuntimePermission](../../../lang/RuntimePermission.html#)`(\"accessUserInformation\")` or its [checkRead](../../../lang/SecurityManager.html#checkRead(kotlin.String)) method denies read access to the file. |\n\n### name\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun name(): String!\n```\n\nReturns the name of the attribute view. Attribute views of this type have the name `\"owner\"`.\n\n| Return ||\n|-----------------------------------------------------------------------------------|--------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | the name of the attribute view |\n\n### setOwner\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun setOwner(owner: UserPrincipal!): Unit\n```\n\nUpdates the file owner.\n\nIt is implementation specific if the file owner can be a [group](/reference/kotlin/java/nio/file/attribute/GroupPrincipal). 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.\n\n| Parameters ||\n|---------|-----------------------------------------------------------------------------------------------|\n| `owner` | [UserPrincipal](/reference/kotlin/java/nio/file/attribute/UserPrincipal)!: the new file owner |\n\n| Exceptions ||\n|-------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `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 |\n| `java.lang.SecurityException` | In the case of the default provider, a security manager is installed, and it denies [RuntimePermission](../../../lang/RuntimePermission.html#)`(\"accessUserInformation\")` or its [checkWrite](../../../lang/SecurityManager.html#checkWrite(kotlin.String)) method denies write access to the file. |"]]