Files.SetOwner(IPath, IUserPrincipal) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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);
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.