Package org.apache.lucene.tests.mockfile
Class WindowsFS
- java.lang.Object
-
- java.nio.file.spi.FileSystemProvider
-
- org.apache.lucene.tests.mockfile.FilterFileSystemProvider
-
- org.apache.lucene.tests.mockfile.HandleTrackingFS
-
- org.apache.lucene.tests.mockfile.WindowsFS
-
public class WindowsFS extends HandleTrackingFS
FileSystem that (imperfectly) acts like windows.Currently this filesystem only prevents deletion of open files.
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.tests.mockfile.FilterFileSystemProvider
delegate, fileSystem, scheme
-
-
Constructor Summary
Constructors Constructor Description WindowsFS(FileSystem delegate)Create a new instance, wrapping the delegate filesystem to act like Windows.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete(Path path)booleandeleteIfExists(Path path)voidmove(Path source, Path target, CopyOption... options)protected voidonClose(Path path, Object stream)Called whenpathis closed viastream.protected voidonOpen(Path path, Object stream)Called whenpathis opened viastream.FilterPathwrapPath(Path path)wraps a Path with provider-specific behavior-
Methods inherited from class org.apache.lucene.tests.mockfile.HandleTrackingFS
newAsynchronousFileChannel, newByteChannel, newDirectoryStream, newFileChannel, newInputStream, newOutputStream
-
Methods inherited from class org.apache.lucene.tests.mockfile.FilterFileSystemProvider
checkAccess, copy, createDirectory, createLink, createSymbolicLink, getFileAttributeView, getFileStore, getFileSystem, getPath, getScheme, isHidden, isSameFile, newFileSystem, newFileSystem, onClose, readAttributes, readAttributes, readSymbolicLink, setAttribute, toDelegate, toString
-
Methods inherited from class java.nio.file.spi.FileSystemProvider
installedProviders
-
-
-
-
Constructor Detail
-
WindowsFS
public WindowsFS(FileSystem delegate)
Create a new instance, wrapping the delegate filesystem to act like Windows.- Parameters:
delegate- delegate filesystem to wrap.
-
-
Method Detail
-
onOpen
protected void onOpen(Path path, Object stream) throws IOException
Description copied from class:HandleTrackingFSCalled whenpathis opened viastream.- Specified by:
onOpenin classHandleTrackingFS- Parameters:
path- Path that was openedstream- Stream or Channel opened against the path.- Throws:
IOException- if an I/O error occurs.
-
onClose
protected void onClose(Path path, Object stream) throws IOException
Description copied from class:HandleTrackingFSCalled whenpathis closed viastream.- Specified by:
onClosein classHandleTrackingFS- Parameters:
path- Path that was closedstream- Stream or Channel closed against the path.- Throws:
IOException- if an I/O error occurs.
-
delete
public void delete(Path path) throws IOException
- Overrides:
deletein classFilterFileSystemProvider- Throws:
IOException
-
move
public void move(Path source, Path target, CopyOption... options) throws IOException
- Overrides:
movein classFilterFileSystemProvider- Throws:
IOException
-
deleteIfExists
public boolean deleteIfExists(Path path) throws IOException
- Overrides:
deleteIfExistsin classFilterFileSystemProvider- Throws:
IOException
-
wrapPath
public FilterPath wrapPath(Path path)
Description copied from class:FilterFileSystemProviderwraps a Path with provider-specific behavior- Overrides:
wrapPathin classFilterFileSystemProvider
-
-