@ParametersAreNonnullByDefault public abstract class FileAttributesProvider extends Object implements FileAttributeView
Use this class if you want to implement your own file attribute view.See this pagefor an example.
Unless otherwise noted, all methods defined by this class do not accept
null arguments, and will throw a NullPointerException
if a null
argument is passed as a parameter.
FileAttributeView
Modifier | Constructor and Description |
---|---|
protected |
FileAttributesProvider(String name)
Protected constructor
|
Modifier and Type | Method and Description |
---|---|
abstract Map<String,Object> |
getAllAttributes()
Get all attributes for this view
|
abstract Object |
getAttributeByName(String name)
Get an attribute value by name
|
String |
name() |
abstract void |
setAttributeByName(String name,
Object value)
Set one attribute by name
|
protected FileAttributesProvider(String name) throws IOException
name
- the name of the viewIOException
- failure to create the providerpublic final String name()
name
in interface AttributeView
public abstract void setAttributeByName(String name, Object value) throws IOException
name
- the name of the attributevalue
- the value of the attributeIOException
- I/O error when trying to set the attributeReadOnlyAttributeException
- the attribute is read onlyNoSuchAttributeException
- an attribute by this name does not exist
for this view@Nullable public abstract Object getAttributeByName(String name) throws IOException
name
- the name of the attributeIOException
- I/O error when trying to set the attributeNoSuchAttributeException
- an attribute by this name does not exist
for this view@Nonnull public abstract Map<String,Object> getAllAttributes() throws IOException
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.
IOException
- failure to read one or more attributes