APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.nio.fs

pack-priv abstract Class UnixFileStore

extends FileStore
Class Inheritance
Known Direct Subclasses
sun.nio.fs.LinuxFileStore
Imports
sun.nio.cs.UTF_8, jdk.internal.util.StaticProperty, java.nio.file.*, java.nio.file.attribute.*, java.nio.channels.*, java.util.*, java.io.IOException

Base implementation of FileStore for Unix/like implementations.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum

Field Summary

Modifier and TypeField and Description
private final long
private final UnixMountEntry
private final UnixPath
private static final Object
private static volatile Properties

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv UnixFileStore.FeatureStatus
checkIfFeaturePresent(String feature)

Returns status to indicate if file system supports a given feature

pack-priv long
dev()

private static long
pack-priv UnixMountEntry
public boolean
equals(Object ob)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

pack-priv UnixPath
file()

pack-priv abstract UnixMountEntry
findMountEntry()

Find the mount entry for the file store

public Object
getAttribute(String attribute)

Implements abstract java.nio.file.FileStore.getAttribute.

Reads the value of a file store attribute.

public long
getBlockSize()

Overrides java.nio.file.FileStore.getBlockSize.

Returns the number of bytes per block in this file store.

public <V extends FileStoreAttributeView> V
getFileStoreAttributeView(Class<V> view)

Implements abstract java.nio.file.FileStore.getFileStoreAttributeView.

Returns a FileStoreAttributeView of the given type.

public long
getTotalSpace()

Implements abstract java.nio.file.FileStore.getTotalSpace.

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

public long
getUnallocatedSpace()

Implements abstract java.nio.file.FileStore.getUnallocatedSpace.

Returns the number of unallocated bytes in the file store.

public long
getUsableSpace()

Implements abstract java.nio.file.FileStore.getUsableSpace.

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

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

protected boolean

Returns:

true if enabled, false if disabled or unable to determine
isExtendedAttributesEnabled
(UnixPath
A path pointing to an existing node, such as the file system's root
path
)

Checks whether extended attributes are enabled on the file system where the given file resides.

public boolean
isReadOnly()

Implements abstract java.nio.file.FileStore.isReadOnly.

Tells whether this file store is read-only.

private static Properties
public String
name()

Implements abstract java.nio.file.FileStore.name.

Returns the name of this file store.

private UnixFileStoreAttributes
public boolean
supportsFileAttributeView(Class<? extends FileAttributeView> type)

Implements abstract java.nio.file.FileStore.supportsFileAttributeView.

Tells whether or not this file store supports the file attributes identified by the given file attribute view.

public boolean
supportsFileAttributeView(String name)

Implements abstract java.nio.file.FileStore.supportsFileAttributeView.

Tells whether or not this file store supports the file attributes identified by the given file attribute view.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public String
type()

Implements abstract java.nio.file.FileStore.type.

Returns the type of this file store.

Field Detail

devback to summary
private final long dev
entryback to summary
private final UnixMountEntry entry
fileback to summary
private final UnixPath file
loadLockback to summary
private static final Object loadLock
propsback to summary
private static volatile Properties props

Constructor Detail

UnixFileStoreback to summary
pack-priv UnixFileStore(UnixPath file) throws IOException
UnixFileStoreback to summary
pack-priv UnixFileStore(UnixFileSystem fs, UnixMountEntry entry) throws IOException

Method Detail

checkIfFeaturePresentback to summary
pack-priv UnixFileStore.FeatureStatus checkIfFeaturePresent(String feature)

Returns status to indicate if file system supports a given feature

devback to summary
pack-priv long dev()
devForback to summary
private static long devFor(UnixPath file) throws IOException
entryback to summary
pack-priv UnixMountEntry entry()
equalsback to summary
public boolean equals(Object ob)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
fileback to summary
pack-priv UnixPath file()
findMountEntryback to summary
pack-priv abstract UnixMountEntry findMountEntry() throws IOException

Find the mount entry for the file store

getAttributeback to summary
public Object getAttribute(String attribute) throws IOException

Implements abstract java.nio.file.FileStore.getAttribute.

Doc from java.nio.file.FileStore.getAttribute.

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 name of a AttributeView 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");
boolean compression = (Boolean)fs.getAttribute("zfs:compression");
Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
getBlockSizeback to summary
public long getBlockSize() throws IOException

Overrides java.nio.file.FileStore.getBlockSize.

Doc from java.nio.file.FileStore.getBlockSize.

Returns the number of bytes per block in this file store.

File storage is typically organized into discrete sequences of bytes called blocks. A block is the smallest storage unit of a file store. Every read and write operation is performed on a multiple of blocks.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
getFileStoreAttributeViewback to summary
public <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> view)

Implements abstract java.nio.file.FileStore.getFileStoreAttributeView.

Doc from java.nio.file.FileStore.getFileStoreAttributeView.

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.

Annotations
@Override
getTotalSpaceback to summary
public long getTotalSpace() throws IOException

Implements abstract java.nio.file.FileStore.getTotalSpace.

Doc from java.nio.file.FileStore.getTotalSpace.

Returns the size, in bytes, of the file store. If the total number of bytes in the file store is greater than Long#MAX_VALUE, then Long.MAX_VALUE will be returned.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
getUnallocatedSpaceback to summary
public long getUnallocatedSpace() throws IOException

Implements abstract java.nio.file.FileStore.getUnallocatedSpace.

Doc from java.nio.file.FileStore.getUnallocatedSpace.

Returns the number of unallocated bytes in the file store. If the number of unallocated bytes is greater than Long#MAX_VALUE, then Long.MAX_VALUE will be returned.

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 this method returns. It is likely to be made inaccurate by any external I/O operations including those made on the system outside of this virtual machine.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
getUsableSpaceback to summary
public long getUsableSpace() throws IOException

Implements abstract java.nio.file.FileStore.getUsableSpace.

Doc from java.nio.file.FileStore.getUsableSpace.

Returns the number of bytes available to this Java virtual machine on the file store. If the number of bytes available is greater than Long#MAX_VALUE, then Long.MAX_VALUE will be returned.

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 this method returns. 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.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
isExtendedAttributesEnabledback to summary
protected boolean isExtendedAttributesEnabled(UnixPath path)

Checks whether extended attributes are enabled on the file system where the given file resides.

Parameters
path:UnixPath

A path pointing to an existing node, such as the file system's root

Returns:boolean

true if enabled, false if disabled or unable to determine

isReadOnlyback to summary
public boolean isReadOnly()

Implements abstract java.nio.file.FileStore.isReadOnly.

Doc from java.nio.file.FileStore.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.

Annotations
@Override
loadPropertiesback to summary
private static Properties loadProperties()
nameback to summary
public String name()

Implements abstract java.nio.file.FileStore.name.

Doc from java.nio.file.FileStore.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.

Annotations
@Override
readAttributesback to summary
private UnixFileStoreAttributes readAttributes() throws IOException
supportsFileAttributeViewback to summary
public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type)

Implements abstract java.nio.file.FileStore.supportsFileAttributeView.

Doc from java.nio.file.FileStore.supportsFileAttributeView.

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.

Annotations
@Override
supportsFileAttributeViewback to summary
public boolean supportsFileAttributeView(String name)

Implements abstract java.nio.file.FileStore.supportsFileAttributeView.

Doc from java.nio.file.FileStore.supportsFileAttributeView.

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.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
typeback to summary
public String type()

Implements abstract java.nio.file.FileStore.type.

Doc from java.nio.file.FileStore.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.

Annotations
@Override
sun.nio.fs back to summary

pack-priv final Enum UnixFileStore.FeatureStatus

extends Enum<UnixFileStore.FeatureStatus>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final UnixFileStore.FeatureStatus
public static final UnixFileStore.FeatureStatus
public static final UnixFileStore.FeatureStatus

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static UnixFileStore.FeatureStatus
public static UnixFileStore.FeatureStatus[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

NOT_PRESENTback to summary
public static final UnixFileStore.FeatureStatus NOT_PRESENT
PRESENTback to summary
public static final UnixFileStore.FeatureStatus PRESENT
UNKNOWNback to summary
public static final UnixFileStore.FeatureStatus UNKNOWN

Constructor Detail

FeatureStatusback to summary
private FeatureStatus()

Method Detail

valueOfback to summary
public static UnixFileStore.FeatureStatus valueOf(String name)
valuesback to summary
public static UnixFileStore.FeatureStatus[] values()