# FileStore

public abstract class **FileStore** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
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 `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/Files.html#getFileStore(java.nio.file.Path)` method, or all file
stores can be enumerated by invoking the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileSystem.html#getFileStores()` method.

In addition to the methods defined by this class, a file store may support
one or more `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/FileStoreAttributeView.html` classes
that provide a read-only or updatable view of a set of file store attributes.

### Protected Constructor Summary

|---|---|
|   | [FileStore](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileStore.html#FileStore())() Initializes a new instance of this class. |

### Public Method Summary

|---|---|
| abstract [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [getAttribute](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileStore.html#getAttribute(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) attribute) Reads the value of a file store attribute. |
| abstract \<V extends [FileStoreAttributeView](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/FileStoreAttributeView.html)\> V | [getFileStoreAttributeView](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileStore.html#getFileStoreAttributeView(java.lang.Class<V>))([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<V\> type) Returns a `FileStoreAttributeView` of the given type. |
| abstract long | [getTotalSpace](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileStore.html#getTotalSpace())() Returns the size, in bytes, of the file store. |
| abstract long | [getUnallocatedSpace](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileStore.html#getUnallocatedSpace())() Returns the number of unallocated bytes in the file store. |
| abstract long | [getUsableSpace](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileStore.html#getUsableSpace())() Returns the number of bytes available to this Java virtual machine on the file store. |
| abstract boolean | [isReadOnly](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileStore.html#isReadOnly())() Tells whether this file store is read-only. |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [name](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileStore.html#name())() Returns the name of this file store. |
| abstract boolean | [supportsFileAttributeView](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileStore.html#supportsFileAttributeView(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name) Tells whether or not this file store supports the file attributes identified by the given file attribute view. |
| abstract boolean | [supportsFileAttributeView](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileStore.html#supportsFileAttributeView(java.lang.Class<?%20extends%20java.nio.file.attribute.FileAttributeView>))([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<? extends [FileAttributeView](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/FileAttributeView.html)\> type) Tells whether or not this file store supports the file attributes identified by the given file attribute view. |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [type](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileStore.html#type())() Returns the *type* of this file store. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Protected Constructors

#### protected
**FileStore**
()

Initializes a new instance of this class.

## Public Methods

#### public abstract [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)
**getAttribute**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) attribute)

Reads the value of a file store attribute.

The `attribute` parameter identifies the attribute to be read
and takes the form:
> *view-name***:** *attribute-name*
where the character `':'` stands for itself.

*view-name* is the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/AttributeView.html#name()` of
a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileStore.html` that identifies a set of file attributes.
*attribute-name* is the name of the attribute.

**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");
 
```

<br />

##### Parameters

| attribute | the attribute to read |
|---|---|

##### Returns

- the attribute value; `null` may be a valid valid for some attributes

##### Throws

| [UnsupportedOperationException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/UnsupportedOperationException.html) | if the attribute view is not available or it does not support reading the attribute |
| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error occurs |
|---|---|

#### public abstract V
**getFileStoreAttributeView**
([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<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.

##### 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

#### public abstract long
**getTotalSpace**
()

Returns the size, in bytes, of the file store.

##### Returns

- the size of the file store, in bytes

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error occurs |
|---|---|

#### public abstract long
**getUnallocatedSpace**
()

Returns the number of unallocated bytes in the file store.

The returned number of unallocated bytes is a hint, but not a
guarantee, that it is possible to use most or any of these bytes. The
number of unallocated bytes is most likely to be accurate immediately
after the space attributes are obtained. It is likely to be
made inaccurate by any external I/O operations including those made on
the system outside of this virtual machine.

##### Returns

- the number of unallocated bytes

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error occurs |
|---|---|

#### public abstract long
**getUsableSpace**
()

Returns the number of bytes available to this Java virtual machine on the
file store.

The returned number of available bytes is a hint, but not a
guarantee, that it is possible to use most or any of these bytes. The
number of usable bytes is most likely to be accurate immediately
after the space attributes are obtained. It is likely to be made inaccurate
by any external I/O operations including those made on the system outside
of this Java virtual machine.

##### Returns

- the number of bytes available

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error occurs |
|---|---|

#### 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

#### public abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**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 `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString()` method.

##### Returns

- the name of this file store

#### public abstract boolean
**supportsFileAttributeView**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) 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 `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/BasicFileAttributeView.html`, 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 `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/AttributeView.html#name()` of file attribute view |
|---|---|

##### Returns

- `true` if, and only if, the file attribute view is supported

#### public abstract boolean
**supportsFileAttributeView**
([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<? extends [FileAttributeView](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/FileAttributeView.html)\> 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 `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/BasicFileAttributeView.html` 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

#### public abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**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