Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/java/nio/file/attribute/FileOwnerAttributeView#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/nio/file/attribute/FileOwnerAttributeView#inhmethods)

# FileOwnerAttributeView

` public interface FileOwnerAttributeView `   
` implements https://developer.android.com/reference/java/nio/file/attribute/FileAttributeView `

|---|
| java.nio.file.attribute.FileOwnerAttributeView |

Known indirect subclasses [AclFileAttributeView](https://developer.android.com/reference/java/nio/file/attribute/AclFileAttributeView), [PosixFileAttributeView](https://developer.android.com/reference/java/nio/file/attribute/PosixFileAttributeView) [AclFileAttributeView](https://developer.android.com/reference/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](https://developer.android.com/reference/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.   

*** ** * ** ***

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 `https://developer.android.com/reference/java/nio/file/attribute/FileOwnerAttributeView#getOwner()` or `https://developer.android.com/reference/java/nio/file/attribute/FileOwnerAttributeView#setOwner(java.nio.file.attribute.UserPrincipal)` methods may be used to read or update the owner of the file.

The `https://developer.android.com/reference/java/nio/file/Files#getAttribute(java.nio.file.Path,%20java.lang.String,%20java.nio.file.LinkOption[])` and `https://developer.android.com/reference/java/nio/file/Files#setAttribute(java.nio.file.Path,%20java.lang.String,%20java.lang.Object,%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 `https://developer.android.com/reference/java/nio/file/attribute/UserPrincipal`.

## Summary

| ### Public methods ||
|---|---|
| ` abstract https://developer.android.com/reference/java/nio/file/attribute/UserPrincipal` | ` https://developer.android.com/reference/java/nio/file/attribute/FileOwnerAttributeView#getOwner()() ` Read the file owner. |
| ` abstract https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/nio/file/attribute/FileOwnerAttributeView#name()() ` Returns the name of the attribute view. |
| ` abstract void` | ` https://developer.android.com/reference/java/nio/file/attribute/FileOwnerAttributeView#setOwner(java.nio.file.attribute.UserPrincipal)(https://developer.android.com/reference/java/nio/file/attribute/UserPrincipal owner) ` Updates the file owner. |

### Inherited methods

From interface ` https://developer.android.com/reference/java/nio/file/attribute/AttributeView ` ` abstract https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/nio/file/attribute/AttributeView#name()() `

Returns the name of the attribute view.

## Public methods

### getOwner

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract UserPrincipal getOwner ()
```

Read the file owner.

It is implementation specific if the file owner can be a `https://developer.android.com/reference/java/nio/file/attribute/GroupPrincipal`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/nio/file/attribute/UserPrincipal` | the file owner <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` | if an I/O error occurs |
| `https://developer.android.com/reference/java/lang/SecurityException` | In the case of the default provider, a security manager is installed, and it denies `https://developer.android.com/reference/java/lang/RuntimePermission``("accessUserInformation")` or its `https://developer.android.com/reference/java/lang/SecurityManager#checkRead(java.lang.String)` method denies read access to the file. |

### name

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract String name ()
```

Returns the name of the attribute view. Attribute views of this type have the name `"owner"`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the name of the attribute view <br /> |

### setOwner

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void setOwner (UserPrincipal owner)
```

Updates the file owner.

It is implementation specific if the file owner can be a `https://developer.android.com/reference/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.

<br />

| Parameters ||
|---|---|
| `owner` | `UserPrincipal`: the new file owner <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/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 |
| `https://developer.android.com/reference/java/lang/SecurityException` | In the case of the default provider, a security manager is installed, and it denies `https://developer.android.com/reference/java/lang/RuntimePermission``("accessUserInformation")` or its `https://developer.android.com/reference/java/lang/SecurityManager#checkWrite(java.lang.String)` method denies write access to the file. |