# FileOwnerAttributeView

public interface **FileOwnerAttributeView** implements [FileAttributeView](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/FileAttributeView.html)

|---|---|---|
| Known Indirect Subclasses [AclFileAttributeView](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/AclFileAttributeView.html), [PosixFileAttributeView](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/PosixFileAttributeView.html) |---|---| | [AclFileAttributeView](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/AclFileAttributeView.html) | A file attribute view that supports reading or updating a file's Access Control Lists (ACL) or file owner attributes. | | [PosixFileAttributeView](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/PosixFileAttributeView.html) | 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://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/FileOwnerAttributeView.html#getOwner()` or `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/FileOwnerAttributeView.html#setOwner(java.nio.file.attribute.UserPrincipal)` methods may
be used to read or update the owner of the file.

The `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/Files.html#getAttribute(java.nio.file.Path,%20java.lang.String,%20java.nio.file.LinkOption...)` and
`https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/Files.html#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://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/UserPrincipal.html`.

### Public Method Summary

|---|---|
| abstract [UserPrincipal](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/UserPrincipal.html) | [getOwner](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/FileOwnerAttributeView.html#getOwner())() Read the file owner. |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [name](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/FileOwnerAttributeView.html#name())() Returns the name of the attribute view. |
| abstract void | [setOwner](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/FileOwnerAttributeView.html#setOwner(java.nio.file.attribute.UserPrincipal))([UserPrincipal](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/UserPrincipal.html) owner) Updates the file owner. |

### Inherited Method Summary

From interface [java.nio.file.attribute.AttributeView](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/AttributeView.html)

|---|---|
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [name](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/AttributeView.html#name())() Returns the name of the attribute view. |

## Public Methods

#### public abstract [UserPrincipal](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/UserPrincipal.html)
**getOwner**
()

Read the file owner.

It it implementation specific if the file owner can be a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/GroupPrincipal.html`.

##### Returns

- the file owner

##### Throws

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

#### public abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**name**
()

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

##### Returns

- the name of the attribute view

#### public abstract void
**setOwner**
([UserPrincipal](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/UserPrincipal.html) owner)

Updates the file owner.

It it implementation specific if the file owner can be a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/GroupPrincipal.html`. 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](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | 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](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/SecurityException.html) | In the case of the default provider, a security manager is installed, and it denies `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/RuntimePermission.html`("accessUserInformation") or its `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/SecurityManager.html#checkWrite(java.lang.String)` method denies write access to the file. |
|---|---|