|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.nio.file.FileStore
public abstract class FileStore
Disabled: no SafeJ information.
Storage for files. A FileStore
represents a storage pool, device,
partition, volume, concrete file system or other implementation specific means
of file storage. The FileStore
for where a file is stored is obtained
by invoking the getFileStore
method, or all file
stores can be enumerated by invoking the getFileStores
method.
In addition to the methods defined by this class, a file store may support
one or more FileStoreAttributeView
classes
that provide a read-only or updatable view of a set of file store attributes.
File stores associated with the default provider support the FileStoreSpaceAttributeView
to read the space related attributes of the
file store.
Constructor Summary | |
---|---|
protected |
FileStore()
Initializes a new instance of this class. |
Method Summary | ||
---|---|---|
abstract Object |
getAttribute(String attribute)
Reads the value of a file store attribute. |
|
abstract
|
getFileStoreAttributeView(Class<V> type)
Returns a FileStoreAttributeView of the given type. |
|
abstract boolean |
isReadOnly()
Tells whether this file store is read-only. |
|
abstract String |
name()
Returns the name of this file store. |
|
abstract boolean |
supportsFileAttributeView(Class<? extends FileAttributeView> type)
Tells whether or not this file store supports the file attributes identified by the given file attribute view. |
|
abstract boolean |
supportsFileAttributeView(String name)
Tells whether or not this file store supports the file attributes identified by the given file attribute view. |
|
abstract String |
type()
Returns the type of this file store. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected FileStore()
Method Detail |
---|
public abstract String name()
The string returned by this method may differ from the string
returned by the toString
method.
public abstract String type()
public abstract boolean isReadOnly()
IOException
to be thrown.
true
if, and only if, this file store is read-onlypublic abstract boolean supportsFileAttributeView(Class<? extends FileAttributeView> type)
Invoking this method to test if the file store supports BasicFileAttributeView
will always return true
. In the case of
the default provider, this method cannot guarantee to give the correct
result when the file store is not a local storage device. The reasons for
this are implementation specific and therefore unspecified.
type
- the file attribute view type
true
if, and only if, the file attribute view is
supportedpublic abstract boolean supportsFileAttributeView(String name)
Invoking this method to test if the file store supports BasicFileAttributeView
, identified by the name "basic
" will
always return true
. In the case of the default provider, this
method cannot guarantee to give the correct result when the file store is
not a local storage device. The reasons for this are implementation
specific and therefore unspecified.
name
- the name
of file attribute view
true
if, and only if, the file attribute view is
supportedpublic abstract <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> type)
FileStoreAttributeView
of the given type.
This method is intended to be used where the file store attribute
view defines type-safe methods to read or update the file store attributes.
The type
parameter is the type of the attribute view required and
the method returns an instance of that type if supported.
For FileStore
objects created by the default provider, then
the file stores support the FileStoreSpaceAttributeView
that
provides access to space attributes. In that case invoking this method
with a parameter value of FileStoreSpaceAttributeView.class
will
always return an instance of that class.
type
- the Class
object corresponding to the attribute view
null
if the attribute view is not availablepublic abstract Object getAttribute(String attribute) throws IOException
The attribute
parameter identifies the attribute to be read
and takes the form:
view-name:attribute-namewhere the character
':'
stands for itself.
view-name is the name
of
a AttributeView
that identifies a set of file attributes.
attribute-name is the name of the attribute.
For FileStore
objects created by the default provider, then
the file stores support the FileStoreSpaceAttributeView
that
provides access to space attributes.
Usage Example: Suppose we want to know if ZFS compression is enabled (assuming the "zfs" view is supported):
boolean compression = (Boolean)fs.getAttribute("zfs:compression");
attribute
- the attribute to read
null
may be a valid valid for some
attributes
UnsupportedOperationException
- if the attribute view is not available or it does not support
reading the attribute
IOException
- if an I/O error occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |