Package org.apache.lucene.tests.mockfile
Class HandleTrackingFS
java.lang.Object
java.nio.file.spi.FileSystemProvider
org.apache.lucene.tests.mockfile.FilterFileSystemProvider
org.apache.lucene.tests.mockfile.HandleTrackingFS
- Direct Known Subclasses:
HandleLimitFS
,LeakFS
,WindowsFS
Base class for tracking file handles.
This class adds tracking to all streams/channels and provides two hooks to handle file management:
-
Field Summary
Fields inherited from class org.apache.lucene.tests.mockfile.FilterFileSystemProvider
delegate, fileSystem, scheme
-
Constructor Summary
ConstructorDescriptionHandleTrackingFS
(String scheme, FileSystem delegate) Create a new instance, identified byscheme
and passing through operations todelegate
. -
Method Summary
Modifier and TypeMethodDescriptionnewAsynchronousFileChannel
(Path path, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs) newByteChannel
(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) newDirectoryStream
(Path dir, DirectoryStream.Filter<? super Path> filter) newFileChannel
(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) newInputStream
(Path path, OpenOption... options) newOutputStream
(Path path, OpenOption... options) protected abstract void
Called whenpath
is closed viastream
.protected abstract void
Called whenpath
is opened viastream
.Methods inherited from class org.apache.lucene.tests.mockfile.FilterFileSystemProvider
checkAccess, copy, createDirectory, createLink, createSymbolicLink, delete, deleteIfExists, getFileAttributeView, getFileStore, getFileSystem, getPath, getScheme, isHidden, isSameFile, move, newFileSystem, newFileSystem, onClose, readAttributes, readAttributes, readSymbolicLink, setAttribute, toDelegate, toString
Methods inherited from class java.nio.file.spi.FileSystemProvider
installedProviders
-
Constructor Details
-
HandleTrackingFS
Create a new instance, identified byscheme
and passing through operations todelegate
.- Parameters:
scheme
- URI scheme for this providerdelegate
- delegate filesystem to wrap.
-
-
Method Details
-
onOpen
Called whenpath
is opened viastream
.- Parameters:
path
- Path that was openedstream
- Stream or Channel opened against the path.- Throws:
IOException
- if an I/O error occurs.
-
onClose
Called whenpath
is closed viastream
.- Parameters:
path
- Path that was closedstream
- Stream or Channel closed against the path.- Throws:
IOException
- if an I/O error occurs.
-
newInputStream
- Overrides:
newInputStream
in classFilterFileSystemProvider
- Throws:
IOException
-
newOutputStream
- Overrides:
newOutputStream
in classFilterFileSystemProvider
- Throws:
IOException
-
newFileChannel
public FileChannel newFileChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException - Overrides:
newFileChannel
in classFilterFileSystemProvider
- Throws:
IOException
-
newAsynchronousFileChannel
public AsynchronousFileChannel newAsynchronousFileChannel(Path path, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs) throws IOException - Overrides:
newAsynchronousFileChannel
in classFilterFileSystemProvider
- Throws:
IOException
-
newByteChannel
public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException - Overrides:
newByteChannel
in classFilterFileSystemProvider
- Throws:
IOException
-
newDirectoryStream
public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) throws IOException - Overrides:
newDirectoryStream
in classFilterFileSystemProvider
- Throws:
IOException
-