Sprache

Files.SetOwner(IPath, IUserPrincipal) Methode

Definition

Aktualisiert den Dateibesitzer.

[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

Parameter

path
IPath

Der Pfad zur Datei

owner
IUserPrincipal

Der neue Dateibesitzer

Gibt zurück

Der angegebene Pfad

Attribute

Hinweise

Aktualisiert den Dateibesitzer.

Der path Parameter ist einem Dateisystem zugeordnet, das unterstützt FileOwnerAttributeView. Diese Datei-Attributansicht bietet Zugriff auf ein Dateiattribute, das der Besitzer der Datei ist.

<b>Verwendungsbeispiel:</b> Angenommen, wir möchten "joe" zum Besitzer einer Datei machen:

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

Java Dokumentation für java.nio.file.Files.setOwner(java.nio.file.Path, java.nio.file.attribute.UserPrincipal).

Teile dieser Seite sind Änderungen auf der Grundlage von Arbeiten, die von der Android Open Source Project erstellt und gemeinsam verwendet und gemäß den in der 2.5 Attribution License beschriebenen Begriffen verwendet werden.

Gilt für: