NIO2 API

org.classpath.icedtea.java.nio.file
Class FileStore

java.lang.Object
  extended by org.classpath.icedtea.java.nio.file.FileStore

public abstract class FileStore
extends java.lang.Object

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.

Since:
1.7

Constructor Summary
protected FileStore()
          Initializes a new instance of this class.
 
Method Summary
abstract
<V extends FileStoreAttributeView>
V
getFileStoreAttributeView(java.lang.Class<V> type)
          Returns a FileStoreAttributeView of the given type.
abstract  FileStoreAttributeView getFileStoreAttributeView(java.lang.String name)
          Returns a FileStoreAttributeView of the given name.
abstract  boolean isReadOnly()
          Tells whether this file store is read-only.
abstract  java.lang.String name()
          Returns the name of this file store.
abstract  boolean supportsFileAttributeView(java.lang.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(java.lang.String name)
          Tells whether or not this file store supports the file attributes identified by the given file attribute view.
abstract  java.lang.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

FileStore

protected FileStore()
Initializes a new instance of this class.

Method Detail

name

public abstract java.lang.String name()
Returns the name of this file store. The format of the name is highly implementation specific. It will typically be the name of the storage pool or volume.

The string returned by this method may differ from the string returned by the toString method.

Returns:
The name of this file store

type

public abstract java.lang.String type()
Returns the type of this file store. The format of the string returned by this method is highly implementation specific. It may indicate, for example, the format used or if the file store is local or remote.

Returns:
A string representing the type of this file store

isReadOnly

public abstract boolean isReadOnly()
Tells whether this file store is read-only. A file store is read-only if it does not support write operations or other changes to files. Any attempt to create a file, open an existing file for writing etc. causes an IOException to be thrown.

Returns:
true if, and only if, this file store is read-only

supportsFileAttributeView

public abstract boolean supportsFileAttributeView(java.lang.Class<? extends FileAttributeView> type)
Tells whether or not this file store supports the file attributes identified by the given file attribute view.

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.

Parameters:
type - The file attribute view type
Returns:
true if, and only if, the file attribute view is supported

supportsFileAttributeView

public abstract boolean supportsFileAttributeView(java.lang.String name)
Tells whether or not this file store supports the file attributes identified by the given file attribute view.

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.

Parameters:
name - The name of file attribute view
Returns:
true if, and only if, the file attribute view is supported

getFileStoreAttributeView

public abstract <V extends FileStoreAttributeView> V getFileStoreAttributeView(java.lang.Class<V> type)
Returns a 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.

Parameters:
type - The Class object corresponding to the attribute view
Returns:
A file store attribute view of the specified type or null if the attribute view is not available

getFileStoreAttributeView

public abstract FileStoreAttributeView getFileStoreAttributeView(java.lang.String name)
Returns a FileStoreAttributeView of the given name.

This method is intended to be used where dynamic access to file store attributes is required. The name parameter specifies the name of the file store attribute view and this method returns an instance of that view 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 "space" will always return an instance of that class.

Parameters:
name - The name of the attribute view
Returns:
A file store attribute view of the given name, or null if the attribute view is not available

NIO2 API

Submit a bug or feature

Copyright 2010 Sun Microsystems, Inc. All rights reserved. Use is subject to the terms of the GNU General Public License.