Top Description Fields Constructors Methods
jdk.internal.jrtfs

pack-priv final Class JrtFileStore

extends FileStore
Class Inheritance
Imports
java.io.IOException, java.nio.file.FileStore, .FileSystem, java.nio.file.attribute.FileAttributeView, .BasicFileAttributeView, .FileStoreAttributeView, java.util.Objects

File store implementation for jrt file systems.

Implementation Note

This class needs to maintain JDK 8 source compatibility. It is used internally in the JDK to implement jimage/jrtfs access, but also compiled and delivered as part of the jrtfs.jar to support access to the jimage file provided by the shipped JDK by tools running on JDK 8.

Field Summary

Modifier and TypeField and Description
protected final FileSystem

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Object
getAttribute(String
the attribute to read
attribute
)

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

Reads the value of a file store attribute.

public <V extends FileStoreAttributeView> V
getFileStoreAttributeView(Class<V>
the Class object corresponding to the attribute view
type
)

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 boolean
isReadOnly()

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

Tells whether this file store is read-only.

public String
name()

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

Returns the name of this file store.

public boolean
supportsFileAttributeView(String
the name of file attribute view
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 boolean
supportsFileAttributeView(Class<? extends FileAttributeView>
the file attribute view type
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 String
type()

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

Returns the type of this file store.

Inherited from java.nio.file.FileStore:
getBlockSize

Field Detail

jrtfsback to summary
protected final FileSystem jrtfs

Constructor Detail

JrtFileStoreback to summary
pack-priv JrtFileStore(JrtPath jrtPath)

Method Detail

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");
Parameters
attribute:String

the attribute to read

Returns:Object

the attribute value; null may be valid for some attributes

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

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.

Parameters
<V>
The FileStoreAttributeView type
type:Class<V>

the Class object corresponding to the attribute view

Returns:V

a file store attribute view of the specified type or null if the attribute view is not available

Annotations
@Override
@SuppressWarnings:unchecked
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.

Returns:long

the size of the file store, in bytes

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.

Returns:long

the current number of unallocated bytes

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.

Returns:long

the current number of usable bytes

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
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.

Returns:boolean

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

Annotations
@Override
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.

Returns:String

the name of this file store

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.

Parameters
name:String

the name of file attribute view

Returns:boolean

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

Annotations
@Override
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.

Parameters
type:Class<? extends FileAttributeView>

the file attribute view type

Returns:boolean

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

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.

Returns:String

a string representing the type of this file store

Annotations
@Override