Package java.nio.file.attribute
AttributeView Can read or update non-opaque values associated with objects in a file system FileAttributeView Can read or update file attributes BasicFileAttributeView Can read or update a basic set of file attributes PosixFileAttributeView Can read or update POSIX defined file attributes DosFileAttributeView Can read or update FAT file attributes FileOwnerAttributeView Can read or update the owner of a file AclFileAttributeView Can read or update Access Control Lists UserDefinedFileAttributeView Can read or update user-defined file attributes FileStoreAttributeView Can read or update file system attributes
属性视图提供与文件系统中的对象关联的非不透明值或元数据的只读或可更新视图。 FileAttributeView接口由几个其他接口扩展,这些接口提供特定文件属性集的视图。 FileAttributeViews通过调用选择Files.getFileAttributeView(java.nio.file.Path, java.lang.Class<V>, java.nio.file.LinkOption...)与类型令牌的方法来确定所需的视图。 视图也可以通过名称识别。 FileStoreAttributeView接口提供对文件存储属性的访问。 甲FileStoreAttributeView给定类型的通过调用获得FileStore.getFileStoreAttributeView(java.lang.Class<V>)方法。
BasicFileAttributeView类定义了读取和更新许多文件系统通用的基本文件属性集的方法。
PosixFileAttributeView接口通过定义方法来扩展BasicFileAttributeView ,以访问文件系统和实现可移植操作系统接口(POSIX)标准系列的操作系统常用的文件属性。
DosFileAttributeView类通过定义访问文件系统(例如文件分配Tabl(FAT)上支持的旧版“DOS”文件属性的方法扩展了BasicFileAttributeView ,这些属性通常用于消费者设备中。
AclFileAttributeView类定义了读取和写入访问控制列表(ACL)文件属性的方法。 此文件属性视图使用的ACL模型基于RFC 3530: Network File System (NFS) version 4 Protocol定义的模型。
除了属性视图,此包还定义了访问属性时使用的类和接口:
-
UserPrincipal和GroupPrincipal接口表示身份或组标识。 -
UserPrincipalLookupService接口定义了查找用户或组主体的方法。 -
FileAttribute接口表示在文件系统中创建对象时需要以原子方式设置属性值的情况的属性值。
除非另有说明,否则将null参数传递给此包中任何类或接口中的构造函数或方法将导致抛出NullPointerException 。
- 从以下版本开始:
- 1.7
-
接口摘要 接口 描述 AclFileAttributeView 一个文件属性视图,支持读取或更新文件的访问控制列表(ACL)或文件所有者属性。AttributeView 一个对象,它提供与文件系统中的对象关联的非透明值的只读或可更新 视图 。BasicFileAttributes 与文件系统中的文件关联的基本属性。BasicFileAttributeView 文件属性视图,提供许多文件系统通用的 基本文件属性 集的视图。DosFileAttributes 与支持旧版“DOS”属性的文件系统中的文件关联的文件属性。DosFileAttributeView 文件属性视图,提供旧版“DOS”文件属性的视图。FileAttribute<T> 封装文件属性值的对象,可以通过调用createFile或createDirectory方法在创建新文件或目录时以原子方式设置该属性。FileAttributeView 属性视图,它是与文件系统中的文件关联的非不透明值的只读或可更新视图。FileOwnerAttributeView 一个文件属性视图,支持读取或更新文件的所有者。FileStoreAttributeView 属性视图,它是FileStore属性的只读或可更新视图。GroupPrincipal 表示 组标识的UserPrincipal,用于确定对文件系统中对象的访问权限。PosixFileAttributes 与实现可移植操作系统接口(POSIX)标准系列的操作系统使用的文件系统上的文件关联的文件属性。PosixFileAttributeView 文件属性视图,提供通常与实现可移植操作系统接口(POSIX)标准系列的操作系统所使用的文件系统上的文件相关联的文件属性的视图。UserDefinedFileAttributeView 文件属性视图,提供文件用户定义属性的视图,有时称为 扩展属性 。UserPrincipal Principal表示用于确定对文件系统中的对象的访问权限的标识。 -
类摘要 类 描述 AclEntry 访问控制列表(ACL)中的条目。AclEntry.Builder AclEntry对象的构建器。FileTime 表示文件的时间戳属性的值。PosixFilePermissions 此类仅包含对PosixFilePermission个对象集合进行操作的静态方法。UserPrincipalLookupService 按名称查找用户和组主体的对象。 -
枚举摘要 Enum 描述 AclEntryFlag 定义ACLentry的flags组件使用的标志。AclEntryPermission 定义用于ACLentry的权限组件的权限。AclEntryType 访问控制条目类型的类型安全枚举。PosixFilePermission 定义用于permissions属性的位。 -
异常摘要 异常 描述 UserPrincipalNotFoundException 查找UserPrincipal因为主体不存在而失败时检查异常。