Files.SetOwner(IPath, IUserPrincipal) Method

Definition

Updates the file owner.

[Android.Runtime.Register("setOwner", "(Ljava/nio/file/Path;Ljava/nio/file/attribute/UserPrincipal;)Ljava/nio/file/Path;", "", ApiSince=26)]
public static Java.Nio.FileNio.IPath? SetOwner (Java.Nio.FileNio.IPath? path, Java.Nio.FileNio.Attributes.IUserPrincipal? owner);
[<Android.Runtime.Register("setOwner", "(Ljava/nio/file/Path;Ljava/nio/file/attribute/UserPrincipal;)Ljava/nio/file/Path;", "", ApiSince=26)>]
static member SetOwner : Java.Nio.FileNio.IPath * Java.Nio.FileNio.Attributes.IUserPrincipal -> Java.Nio.FileNio.IPath

Parameters

path
IPath

The path to the file

owner
IUserPrincipal

The new file owner

Returns

The path

Attributes

Remarks

Updates the file owner.

The path parameter is associated with a file system that supports FileOwnerAttributeView. This file attribute view provides access to a file attribute that is the owner of the file.

<b>Usage Example:</b> Suppose we want to make "joe" the owner of a file:

Path path = ...
                UserPrincipalLookupService lookupService =
                    provider(path).getUserPrincipalLookupService();
                UserPrincipal joe = lookupService.lookupPrincipalByName("joe");
                Files.setOwner(path, joe);

Java documentation for java.nio.file.Files.setOwner(java.nio.file.Path, java.nio.file.attribute.UserPrincipal).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to