Files.SetOwner(IPath, IUserPrincipal) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
更新檔案擁有者。
[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
參數
- path
- IPath
檔案路徑
- owner
- IUserPrincipal
新的檔案擁有者
傳回
給定路徑
- 屬性
備註
更新檔案擁有者。
該 path 參數與支援 FileOwnerAttributeView的檔案系統相關聯。 此檔案屬性檢視提供存取該檔案擁有者屬性的存取權。
<b>使用範例:</b> 假設我們想讓「joe」成為檔案的擁有者:
Path path = ...
UserPrincipalLookupService lookupService =
provider(path).getUserPrincipalLookupService();
UserPrincipal joe = lookupService.lookupPrincipalByName("joe");
Files.setOwner(path, joe);
Java 文件 java.nio.file.Files.setOwner(java.nio.file.Path, java.nio.file.attribute.UserPrincipal)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。