org.gridlab.gat.io.attributes
Interface AttributeView

All Known Subinterfaces:
BasicFileAttributeView, FileAttributeView, FileOwnerAttributeView, PosixFileAttributeView

public interface AttributeView

An object that provides a read-only or updatable view of non-opaque values associated with an object in a filesystem. This interface is extended or implemented by specific attribute views that define the attributes supported by the view. A specific attribute view will typically define type-safe methods to read or update the attributes that it supports. It also provides dynamic access where the readAttributes, getAttribute and setAttributs methods are used to access the attributes by names defined by the attribute view. Implementations must ensure that the attribute names do not contain the colon (':') or comma (',') characters.

Since:
1.7

Method Summary
 Object getAttribute(String attribute)
          Reads the value of an attribute.
 String name()
          Returns the name of the attribute view.
 Map<String,?> readAttributes(String first, String... rest)
          Reads all, or a subset, of the attributes supported by this file attribute view.
 void setAttribute(String attribute, Object value)
          Sets/updates the value of an attribute.
 

Method Detail

name

String name()
Returns the name of the attribute view.


getAttribute

Object getAttribute(String attribute)
                    throws IOException
Reads the value of an attribute.

Parameters:
attribute - the attribute name (case sensitive)
Returns:
the value of the attribute, or null if the attribute is not supported
Throws:
IOException - if an I/O error occurs
SecurityException - if a security manager is set and it denies access

setAttribute

void setAttribute(String attribute,
                  Object value)
                  throws IOException
Sets/updates the value of an attribute.

Parameters:
attribute - the attribute name (case sensitive)
value - the attribute value
Throws:
UnsupportedOperationException - if the attribute is not supported or this attribute view does not support updating the value of the attribute
IllegalArgumentException - if the attribute value is of the correct type but has an inappropriate value
ClassCastException - if the attribute value is not of the expected type or is a collection containing elements that are not of the expected type
IOException - if an I/O error occurs
SecurityException - if a security manager is set and it denies access

readAttributes

Map<String,?> readAttributes(String first,
                             String... rest)
                             throws IOException
Reads all, or a subset, of the attributes supported by this file attribute view.

The first and rest parameters are the names of the attributes to read. If any of the parameters has the value "*" then all attributes are read. Attributes that are not supported are ignored and will not be present in the returned map. It is implementation specific if all attributes are read as an atomic operation with respect to other file system operations.

Parameters:
first - the name of an attribute to read (case sensitive)
rest - the names of other attributes to read (case sensitive)
Returns:
an unmodifiable map of the attributes; may be empty. Its keys are the attribute names, its values are the attribute values
Throws:
IOException - if an I/O error occurs
SecurityException - if a security manager is set and it denies access