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
public abstract class HandleTrackingFS extends FilterFileSystemProvider
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
Constructors Constructor Description HandleTrackingFS(String scheme, FileSystem delegate)Create a new instance, identified byschemeand passing through operations todelegate.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description AsynchronousFileChannelnewAsynchronousFileChannel(Path path, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs)SeekableByteChannelnewByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs)DirectoryStream<Path>newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter)FileChannelnewFileChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs)InputStreamnewInputStream(Path path, OpenOption... options)OutputStreamnewOutputStream(Path path, OpenOption... options)protected abstract voidonClose(Path path, Object stream)Called whenpathis closed viastream.protected abstract voidonOpen(Path path, Object stream)Called 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, wrapPath
-
Methods inherited from class java.nio.file.spi.FileSystemProvider
installedProviders
-
-
-
-
Constructor Detail
-
HandleTrackingFS
public HandleTrackingFS(String scheme, FileSystem delegate)
Create a new instance, identified byschemeand passing through operations todelegate.- Parameters:
scheme- URI scheme for this providerdelegate- delegate filesystem to wrap.
-
-
Method Detail
-
onOpen
protected abstract void onOpen(Path path, Object stream) throws IOException
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
protected abstract void onClose(Path path, Object stream) throws IOException
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
public InputStream newInputStream(Path path, OpenOption... options) throws IOException
- Overrides:
newInputStreamin classFilterFileSystemProvider- Throws:
IOException
-
newOutputStream
public OutputStream newOutputStream(Path path, OpenOption... options) throws IOException
- 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
-
-