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
ConstructorsConstructorDescriptionHandleTrackingFS(String scheme, FileSystem delegate) Create a new instance, identified byschemeand 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 voidCalled whenpathis closed viastream.protected abstract voidCalled whenpathis 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, wrapPathMethods inherited from class java.nio.file.spi.FileSystemProvider
exists, installedProviders, readAttributesIfExists
-
Constructor Details
-
HandleTrackingFS
Create a new instance, identified byschemeand passing through operations todelegate.- Parameters:
scheme- URI scheme for this providerdelegate- delegate filesystem to wrap.
-
-
Method Details
-
onOpen
Called whenpathis 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 whenpathis 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:
newInputStreamin classFilterFileSystemProvider- Throws:
IOException
-
newOutputStream
- Overrides:
newOutputStreamin classFilterFileSystemProvider- Throws:
IOException
-
newFileChannel
public FileChannel newFileChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException - Overrides:
newFileChannelin classFilterFileSystemProvider- Throws:
IOException
-
newAsynchronousFileChannel
public AsynchronousFileChannel newAsynchronousFileChannel(Path path, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs) throws IOException - Overrides:
newAsynchronousFileChannelin classFilterFileSystemProvider- Throws:
IOException
-
newByteChannel
public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException - Overrides:
newByteChannelin classFilterFileSystemProvider- Throws:
IOException
-
newDirectoryStream
public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) throws IOException - Overrides:
newDirectoryStreamin classFilterFileSystemProvider- Throws:
IOException
-