@ParametersAreNonnullByDefault public abstract class BasicFileAttributesProvider extends FileAttributesProvider implements BasicFileAttributeView, BasicFileAttributes
"basic"
file attribute view
The defaults are:
isSymbolicLink()
and isOther()
return false
;fileKey()
returns null
.BasicFileAttributeView
,
BasicFileAttributes
Modifier and Type | Field and Description |
---|---|
protected static FileTime |
UNIX_EPOCH |
Modifier | Constructor and Description |
---|---|
protected |
BasicFileAttributesProvider() |
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() |
BasicFileAttributes |
readAttributes() |
void |
setAttributeByName(String name,
Object value)
Set one attribute by name
|
void |
setTimes(FileTime lastModifiedTime,
FileTime lastAccessTime,
FileTime createTime) |
name
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
name
isDirectory, isRegularFile, size
protected static final FileTime UNIX_EPOCH
protected BasicFileAttributesProvider() throws IOException
IOException
public final BasicFileAttributes readAttributes() throws IOException
readAttributes
in interface BasicFileAttributeView
IOException
public FileTime lastModifiedTime()
lastModifiedTime
in interface BasicFileAttributes
public FileTime lastAccessTime()
lastAccessTime
in interface BasicFileAttributes
public FileTime creationTime()
creationTime
in interface BasicFileAttributes
public boolean isSymbolicLink()
isSymbolicLink
in interface BasicFileAttributes
public boolean isOther()
isOther
in interface BasicFileAttributes
public Object fileKey()
fileKey
in interface BasicFileAttributes
public void setTimes(@Nullable FileTime lastModifiedTime, @Nullable FileTime lastAccessTime, @Nullable FileTime createTime) throws IOException
setTimes
in interface BasicFileAttributeView
IOException
public void setAttributeByName(String name, Object value) throws IOException
FileAttributesProvider
setAttributeByName
in class FileAttributesProvider
name
- 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
FileAttributesProvider
getAttributeByName
in class FileAttributesProvider
name
- the name of the attributeIOException
- I/O error when trying to set the attribute@Nonnull public final Map<String,Object> getAllAttributes() throws IOException
FileAttributesProvider
The 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 FileAttributesProvider
IOException
- failure to read one or more attributes