@ParametersAreNonnullByDefault public abstract class PosixFileAttributesProvider extends FileAttributesProvider implements PosixFileAttributeView, PosixFileAttributes
"posix" file attribute view
The default values are the same as BasicFileAttributesProvider;
in addition, the default permissions are "rwxr-wr-x" for directories
and rw-r--r-- for all other types.
| Modifier and Type | Field and Description |
|---|---|
protected static Set<PosixFilePermission> |
DEFAULT_DIRECTORY_PERMS |
protected static Set<PosixFilePermission> |
DEFAULT_OTHER_PERMS |
protected static FileTime |
UNIX_EPOCH |
| Modifier | Constructor and Description |
|---|---|
protected |
PosixFileAttributesProvider() |
| Modifier and Type | Method and Description |
|---|---|
FileTime |
creationTime() |
Object |
fileKey() |
Map<String,Object> |
getAllAttributes()
Get all attributes for this view
|
Object |
getAttributeByName(String name)
Get an attribute value by name
|
boolean |
isOther() |
boolean |
isSymbolicLink() |
FileTime |
lastAccessTime() |
FileTime |
lastModifiedTime() |
Set<PosixFilePermission> |
permissions() |
PosixFileAttributes |
readAttributes() |
void |
setAttributeByName(String name,
Object value)
Set one attribute by name
|
void |
setGroup(GroupPrincipal group) |
void |
setOwner(UserPrincipal owner) |
void |
setPermissions(Set<PosixFilePermission> perms) |
void |
setTimes(FileTime lastModifiedTime,
FileTime lastAccessTime,
FileTime createTime) |
nameclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnamegetOwnergroup, ownerisDirectory, isRegularFile, sizeprotected static final FileTime UNIX_EPOCH
protected static final Set<PosixFilePermission> DEFAULT_OTHER_PERMS
protected static final Set<PosixFilePermission> DEFAULT_DIRECTORY_PERMS
protected PosixFileAttributesProvider()
throws IOException
IOExceptionpublic final PosixFileAttributes readAttributes() throws IOException
readAttributes in interface BasicFileAttributeViewreadAttributes in interface PosixFileAttributeViewIOExceptionpublic FileTime lastModifiedTime()
lastModifiedTime in interface BasicFileAttributespublic FileTime lastAccessTime()
lastAccessTime in interface BasicFileAttributespublic FileTime creationTime()
creationTime in interface BasicFileAttributespublic boolean isSymbolicLink()
isSymbolicLink in interface BasicFileAttributespublic boolean isOther()
isOther in interface BasicFileAttributespublic Object fileKey()
fileKey in interface BasicFileAttributespublic Set<PosixFilePermission> permissions()
permissions in interface PosixFileAttributespublic void setTimes(@Nullable FileTime lastModifiedTime, @Nullable FileTime lastAccessTime, @Nullable FileTime createTime) throws IOException
setTimes in interface BasicFileAttributeViewIOExceptionpublic void setOwner(UserPrincipal owner) throws IOException
setOwner in interface FileOwnerAttributeViewIOExceptionpublic void setGroup(GroupPrincipal group) throws IOException
setGroup in interface PosixFileAttributeViewIOExceptionpublic void setPermissions(Set<PosixFilePermission> perms) throws IOException
setPermissions in interface PosixFileAttributeViewIOExceptionpublic void setAttributeByName(String name, Object value) throws IOException
FileAttributesProvidersetAttributeByName in class FileAttributesProvidername - the name of the attributevalue - the value of the attributeIOException - I/O error when trying to set the attributeReadOnlyAttributeException - the attribute is read only@Nonnull public Object getAttributeByName(String name) throws IOException
FileAttributesProvidergetAttributeByName in class FileAttributesProvidername - the name of the attributeIOException - I/O error when trying to set the attribute@Nonnull public final Map<String,Object> getAllAttributes() throws IOException
FileAttributesProviderThe returned map will have the attribute names as keys and their
values as values. The returned map must be immutable (use
Collections.unmodifiableMap(Map) for instance).
The order of keys in the returned map is not guaranteed.
getAllAttributes in class FileAttributesProviderIOException - failure to read one or more attributes