public abstract class HandleTrackingFS extends FilterFileSystemProvider
This class adds tracking to all streams/channels and provides two hooks to handle file management:
delegate, fileSystem, scheme
Constructor and Description |
---|
HandleTrackingFS(String scheme,
FileSystem delegate)
Create a new instance, identified by
scheme and passing
through operations to delegate . |
Modifier and Type | Method and Description |
---|---|
AsynchronousFileChannel |
newAsynchronousFileChannel(Path path,
Set<? extends OpenOption> options,
ExecutorService executor,
FileAttribute<?>... attrs) |
SeekableByteChannel |
newByteChannel(Path path,
Set<? extends OpenOption> options,
FileAttribute<?>... attrs) |
DirectoryStream<Path> |
newDirectoryStream(Path dir,
DirectoryStream.Filter<? super Path> filter) |
FileChannel |
newFileChannel(Path path,
Set<? extends OpenOption> options,
FileAttribute<?>... attrs) |
InputStream |
newInputStream(Path path,
OpenOption... options) |
OutputStream |
newOutputStream(Path path,
OpenOption... options) |
protected abstract void |
onClose(Path path,
Object stream)
Called when
path is closed via stream . |
protected abstract void |
onOpen(Path path,
Object stream)
Called when
path is opened via stream . |
checkAccess, copy, createDirectory, createLink, createSymbolicLink, delete, deleteIfExists, getFileAttributeView, getFileStore, getFileSystem, getPath, getScheme, isHidden, isSameFile, move, newFileSystem, newFileSystem, onClose, readAttributes, readAttributes, readSymbolicLink, setAttribute, toDelegate, toString
installedProviders
public HandleTrackingFS(String scheme, FileSystem delegate)
scheme
and passing
through operations to delegate
.scheme
- URI scheme for this providerdelegate
- delegate filesystem to wrap.protected abstract void onOpen(Path path, Object stream) throws IOException
path
is opened via stream
.path
- Path that was openedstream
- Stream or Channel opened against the path.IOException
- if an I/O error occurs.protected abstract void onClose(Path path, Object stream) throws IOException
path
is closed via stream
.path
- Path that was closedstream
- Stream or Channel closed against the path.IOException
- if an I/O error occurs.public InputStream newInputStream(Path path, OpenOption... options) throws IOException
newInputStream
in class FilterFileSystemProvider
IOException
public OutputStream newOutputStream(Path path, OpenOption... options) throws IOException
newOutputStream
in class FilterFileSystemProvider
IOException
public FileChannel newFileChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException
newFileChannel
in class FilterFileSystemProvider
IOException
public AsynchronousFileChannel newAsynchronousFileChannel(Path path, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs) throws IOException
newAsynchronousFileChannel
in class FilterFileSystemProvider
IOException
public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException
newByteChannel
in class FilterFileSystemProvider
IOException
public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) throws IOException
newDirectoryStream
in class FilterFileSystemProvider
IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.