@ParametersAreNonnullByDefault public abstract class FileSystemDriverBase extends Object implements FileSystemDriver
FileSystemDriver
with some reasonable defaults
The (overridable) defaults are:
UserPrincipalLookupService
s or WatchService
s (both relevant methods throw an UnsupportedOperationException
);SeekableByteChannel
s;isSameFile(Path, Path)
returns true if and only if both
their absolute versions are equal
.UnixLikeFileSystemDriverBase
Modifier and Type | Field and Description |
---|---|
protected FileSystemOptionsFactory |
optionsFactory |
Modifier | Constructor and Description |
---|---|
protected |
FileSystemDriverBase(FileStore fileStore,
FileSystemFactoryProvider factoryProvider) |
Modifier and Type | Method and Description |
---|---|
<V extends FileAttributeView> |
getFileAttributeView(Path path,
Class<V> type,
LinkOption... options)
Read an attribute view for a given path on this filesystem
|
FileStore |
getFileStore()
Get the
FileStore associated with this filesystem |
UserPrincipalLookupService |
getUserPrincipalLookupService()
Get a user/group lookup service for this filesystem
|
boolean |
isSameFile(Path path,
Path path2)
Tell whether two paths actually refer to the same resource on this
filesystem
|
SeekableByteChannel |
newByteChannel(Path path,
Set<? extends OpenOption> options,
FileAttribute<?>... attrs)
Obtain a new
SeekableByteChannel from a path for this filesystem |
WatchService |
newWatchService()
Get a file watch service for this filesystem
|
<A extends BasicFileAttributes> |
readAttributes(Path path,
Class<A> type,
LinkOption... options)
Read attributes from a path on this filesystem
|
Map<String,Object> |
readAttributes(Path path,
String attributes,
LinkOption... options)
Read a list of attributes from a path on this filesystem
|
void |
setAttribute(Path path,
String attribute,
Object value,
LinkOption... options)
Set an attribute for a path on this filesystem
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkAccess, copy, createDirectory, delete, getPathMetadata, isHidden, move, newDirectoryStream, newInputStream, newOutputStream
protected final FileSystemOptionsFactory optionsFactory
protected FileSystemDriverBase(FileStore fileStore, FileSystemFactoryProvider factoryProvider)
@Nonnull public final FileStore getFileStore()
FileSystemDriver
FileStore
associated with this filesystemgetFileStore
in interface FileSystemDriver
FileStore
FileSystem.getFileStores()
,
FileStoreBase
@Nonnull public UserPrincipalLookupService getUserPrincipalLookupService()
FileSystemDriver
getUserPrincipalLookupService
in interface FileSystemDriver
FileSystem.getUserPrincipalLookupService()
@Nonnull public WatchService newWatchService()
FileSystemDriver
newWatchService
in interface FileSystemDriver
FileSystem.newWatchService()
@Nonnull public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException
FileSystemDriver
SeekableByteChannel
from a path for this filesystem
Note that a SeekableByteChannel
supports both reads and
writes.
newByteChannel
in interface FileSystemDriver
path
- the pathoptions
- the set of open optionsattrs
- the attributes to create the file with (if it does not
exist)IOException
- filesystem level error, or a plain I/O errorFileSystemProvider.newByteChannel(Path, Set, FileAttribute[])
public boolean isSameFile(Path path, Path path2) throws IOException
FileSystemDriver
Note that this DOES NOT apply to symbolic links, if the filesystem
supports them; that is, if path
is a symlink to path2
,
they are not the same file. Also, in spite of the method name,
this method can be called on paths which are not regular files but
directories, symlinks or others.
Two paths which are equal
are always the
same.
isSameFile
in interface FileSystemDriver
path
- the first pathpath2
- the second pathIOException
- filesystem level error, or a plain I/O errorFileSystemProvider.isSameFile(Path, Path)
public final void setAttribute(Path path, String attribute, Object value, LinkOption... options) throws IOException
FileSystemDriver
setAttribute
in interface FileSystemDriver
path
- the victimattribute
- the name of the attribute to setvalue
- the value to setoptions
- the link optionsIOException
- filesystem level error, or a plain I/O errorFiles.setAttribute(Path, String, Object, LinkOption...)
,
FileSystemProvider.setAttribute(Path, String, Object, LinkOption...)
public final Map<String,Object> readAttributes(Path path, String attributes, LinkOption... options) throws IOException
FileSystemDriver
readAttributes
in interface FileSystemDriver
path
- the path to read attributes fromattributes
- the list of attributes to readoptions
- the link optionsIOException
- filesystem level error, or a plain I/O errorFiles.readAttributes(Path, String, LinkOption...)
,
FileSystemProvider.readAttributes(Path, String, LinkOption...)
public final <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options) throws IOException
FileSystemDriver
readAttributes
in interface FileSystemDriver
A
- parameter type for the attributs classpath
- the path to read attributes fromtype
- the class of attributes to readoptions
- the link optionsIOException
- filesystem level error, or a plain I/O errorFileSystemProvider.readAttributes(Path, Class, LinkOption...)
@Nullable public final <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options)
FileSystemDriver
getFileAttributeView
in interface FileSystemDriver
V
- type parameter of the attribute view classpath
- the path to read attributes fromtype
- the class of attribute view to returnoptions
- the link optionsnull
if this view is not supportedFileSystemProvider.getFileAttributeView(Path, Class, LinkOption...)