public interface FileOwnerAttributeView extends FileAttributeView
的getOwner
或setOwner
方法可以用来读取或更新该文件的所有者。
的getAttribute
和setAttribute
方法也可以用来读取或更新的主人。在这种情况下,所有者属性由名称"owner"
鉴定,和该属性的值是一个UserPrincipal
。
Modifier and Type | Method and Description |
---|---|
UserPrincipal |
getOwner()
读取文件所有者。
|
String |
name()
返回属性视图的名称。
|
void |
setOwner(UserPrincipal owner)
更新文件所有者。
|
String name()
"owner"
观点。
name
接口
AttributeView
UserPrincipal getOwner() throws IOException
如果文件的所有者可以是一个group
它的具体实施。
IOException
如果I/O错误发生
SecurityException
在默认提供程序的情况下,安装安全管理器,它否认
RuntimePermission
("accessUserInformation")或其
checkRead
法否认对文件的读访问。
void setOwner(UserPrincipal owner) throws IOException
如果文件的所有者可以是一个group
它的具体实施,确保一致和正确行为的跨平台的建议,这个方法只能用于设置文件所有者的用户主要是组。
owner
-新文件的所有者
IOException
-如果一个I/O错误时,或
owner
参数是一组与此实现不支持设置业主一组
SecurityException
在默认提供程序的情况下,安装安全管理器,它否认
RuntimePermission
("accessUserInformation")或其
checkWrite
方法拒绝写访问文件。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.