Package org.apache.lucene.tests.mockfile
Class FilterFileSystemProvider
- java.lang.Object
-
- java.nio.file.spi.FileSystemProvider
-
- org.apache.lucene.tests.mockfile.FilterFileSystemProvider
-
- Direct Known Subclasses:
DisableFsyncFS,ExtrasFS,HandleTrackingFS,ShuffleFS,VerboseFS,VirusCheckingFS
public abstract class FilterFileSystemProvider extends FileSystemProvider
AFilterFileSystemProvidercontains anotherFileSystemProvider, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality.
-
-
Field Summary
Fields Modifier and Type Field Description protected FileSystemProviderdelegateThe underlyingFileSystemProvider.protected FilterFileSystemfileSystemThe underlyingFileSysteminstance.protected StringschemeThe URI scheme for this provider.
-
Constructor Summary
Constructors Constructor Description FilterFileSystemProvider(String scheme, FileSystem delegateInstance)Construct aFilterFileSystemProviderindicated by the specifiedschemeand wrapping functionality of the provider of the specified base filesystem.FilterFileSystemProvider(String scheme, FileSystemProvider delegate)Construct aFilterFileSystemProviderindicated by the specifiedschemeand wrapping functionality of the provider.
-
Method Summary
-
Methods inherited from class java.nio.file.spi.FileSystemProvider
installedProviders
-
-
-
-
Field Detail
-
delegate
protected final FileSystemProvider delegate
The underlyingFileSystemProvider.
-
fileSystem
protected FilterFileSystem fileSystem
The underlyingFileSysteminstance.
-
scheme
protected final String scheme
The URI scheme for this provider.
-
-
Constructor Detail
-
FilterFileSystemProvider
public FilterFileSystemProvider(String scheme, FileSystem delegateInstance)
Construct aFilterFileSystemProviderindicated by the specifiedschemeand wrapping functionality of the provider of the specified base filesystem.- Parameters:
scheme- URI schemedelegateInstance- specified base filesystem.
-
FilterFileSystemProvider
public FilterFileSystemProvider(String scheme, FileSystemProvider delegate)
Construct aFilterFileSystemProviderindicated by the specifiedschemeand wrapping functionality of the provider. You must set the singletonfilesystemyourself.- Parameters:
scheme- URI schemedelegate- specified base provider.
-
-
Method Detail
-
getScheme
public String getScheme()
- Specified by:
getSchemein classFileSystemProvider
-
newFileSystem
public FileSystem newFileSystem(URI uri, Map<String,?> env) throws IOException
- Specified by:
newFileSystemin classFileSystemProvider- Throws:
IOException
-
newFileSystem
public FileSystem newFileSystem(Path path, Map<String,?> env) throws IOException
- Overrides:
newFileSystemin classFileSystemProvider- Throws:
IOException
-
getFileSystem
public FileSystem getFileSystem(URI uri)
- Specified by:
getFileSystemin classFileSystemProvider
-
getPath
public Path getPath(URI uri)
- Specified by:
getPathin classFileSystemProvider
-
wrapPath
public FilterPath wrapPath(Path path)
wraps a Path with provider-specific behavior
-
createDirectory
public void createDirectory(Path dir, FileAttribute<?>... attrs) throws IOException
- Specified by:
createDirectoryin classFileSystemProvider- Throws:
IOException
-
delete
public void delete(Path path) throws IOException
- Specified by:
deletein classFileSystemProvider- Throws:
IOException
-
copy
public void copy(Path source, Path target, CopyOption... options) throws IOException
- Specified by:
copyin classFileSystemProvider- Throws:
IOException
-
move
public void move(Path source, Path target, CopyOption... options) throws IOException
- Specified by:
movein classFileSystemProvider- Throws:
IOException
-
isSameFile
public boolean isSameFile(Path path, Path path2) throws IOException
- Specified by:
isSameFilein classFileSystemProvider- Throws:
IOException
-
isHidden
public boolean isHidden(Path path) throws IOException
- Specified by:
isHiddenin classFileSystemProvider- Throws:
IOException
-
getFileStore
public FileStore getFileStore(Path path) throws IOException
- Specified by:
getFileStorein classFileSystemProvider- Throws:
IOException
-
checkAccess
public void checkAccess(Path path, AccessMode... modes) throws IOException
- Specified by:
checkAccessin classFileSystemProvider- Throws:
IOException
-
getFileAttributeView
public <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options)
- Specified by:
getFileAttributeViewin classFileSystemProvider
-
readAttributes
public <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options) throws IOException
- Specified by:
readAttributesin classFileSystemProvider- Throws:
IOException
-
readAttributes
public Map<String,Object> readAttributes(Path path, String attributes, LinkOption... options) throws IOException
- Specified by:
readAttributesin classFileSystemProvider- Throws:
IOException
-
setAttribute
public void setAttribute(Path path, String attribute, Object value, LinkOption... options) throws IOException
- Specified by:
setAttributein classFileSystemProvider- Throws:
IOException
-
newInputStream
public InputStream newInputStream(Path path, OpenOption... options) throws IOException
- Overrides:
newInputStreamin classFileSystemProvider- Throws:
IOException
-
newOutputStream
public OutputStream newOutputStream(Path path, OpenOption... options) throws IOException
- Overrides:
newOutputStreamin classFileSystemProvider- Throws:
IOException
-
newFileChannel
public FileChannel newFileChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException
- Overrides:
newFileChannelin classFileSystemProvider- Throws:
IOException
-
newAsynchronousFileChannel
public AsynchronousFileChannel newAsynchronousFileChannel(Path path, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs) throws IOException
- Overrides:
newAsynchronousFileChannelin classFileSystemProvider- Throws:
IOException
-
newByteChannel
public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException
- Specified by:
newByteChannelin classFileSystemProvider- Throws:
IOException
-
newDirectoryStream
public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) throws IOException
- Specified by:
newDirectoryStreamin classFileSystemProvider- Throws:
IOException
-
createSymbolicLink
public void createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs) throws IOException
- Overrides:
createSymbolicLinkin classFileSystemProvider- Throws:
IOException
-
createLink
public void createLink(Path link, Path existing) throws IOException
- Overrides:
createLinkin classFileSystemProvider- Throws:
IOException
-
deleteIfExists
public boolean deleteIfExists(Path path) throws IOException
- Overrides:
deleteIfExistsin classFileSystemProvider- Throws:
IOException
-
readSymbolicLink
public Path readSymbolicLink(Path link) throws IOException
- Overrides:
readSymbolicLinkin classFileSystemProvider- Throws:
IOException
-
onClose
protected void onClose()
Override to trigger some behavior when the filesystem is closed.This is always called for each FilterFileSystemProvider in the chain.
-
-