Package org.apache.sshd.common.file.root
Class RootedFileSystemProvider
java.lang.Object
java.nio.file.spi.FileSystemProvider
org.apache.sshd.common.file.root.RootedFileSystemProvider
File system provider which provides a rooted file system. The file system only gives access to files under the root
directory.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<Path, RootedFileSystem> protected final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckAccess(Path path, AccessMode... modes) voidcopy(Path source, Path target, CopyOption... options) voidcreateDirectory(Path dir, FileAttribute<?>... attrs) voidcreateLink(Path link, Path existing) voidcreateSymbolicLink(Path link, Path target, FileAttribute<?>... attrs) voidbooleandeleteIfExists(Path path) private static PathensureDirectory(Path path) private StringfixExceptionFileName(Path root, Path rootedPath, String fileName) <V extends FileAttributeView>
VgetFileAttributeView(Path path, Class<V> type, LinkOption... options) getFileStore(Path path) getFileSystem(URI uri) protected RootedFileSystemgetFileSystem(Path path) booleanbooleanisSameFile(Path path, Path path2) voidmove(Path source, Path target, CopyOption... options) newAsynchronousFileChannel(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) protected FileSystemnewFileSystem(Object src, Path path, Map<String, ?> env) newFileSystem(URI uri, Map<String, ?> env) newFileSystem(Path path, Map<String, ?> env) newInputStream(Path path, OpenOption... options) newOutputStream(Path path, OpenOption... options) protected FileSystemProvider<A extends BasicFileAttributes>
AreadAttributes(Path path, Class<A> type, LinkOption... options) readAttributes(Path path, String attributes, LinkOption... options) readSymbolicLink(Path link) protected PathresolveLocalPath(RootedPath path) protected DirectoryStream<Path> root(RootedFileSystem rfs, DirectoryStream<Path> ds) protected Pathroot(RootedFileSystem rfs, Path nat) voidsetAttribute(Path path, String attribute, Object value, LinkOption... options) private IOExceptiontranslateIoException(IOException ex, Path rootedPath) protected Pathprotected PathMethods inherited from class java.nio.file.spi.FileSystemProvider
installedProviders
-
Field Details
-
log
protected final org.slf4j.Logger log -
fileSystems
-
-
Constructor Details
-
RootedFileSystemProvider
public RootedFileSystemProvider()
-
-
Method Details
-
getScheme
- Specified by:
getSchemein classFileSystemProvider
-
newFileSystem
- Specified by:
newFileSystemin classFileSystemProvider- Throws:
IOException
-
getFileSystem
- Specified by:
getFileSystemin classFileSystemProvider
-
newFileSystem
- Overrides:
newFileSystemin classFileSystemProvider- Throws:
IOException
-
newFileSystem
- Throws:
IOException
-
uriToPath
-
ensureDirectory
-
getPath
- Specified by:
getPathin classFileSystemProvider
-
newInputStream
- Overrides:
newInputStreamin classFileSystemProvider- Throws:
IOException
-
newOutputStream
- 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
-
root
-
createDirectory
- Specified by:
createDirectoryin classFileSystemProvider- Throws:
IOException
-
createSymbolicLink
public void createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs) throws IOException - Overrides:
createSymbolicLinkin classFileSystemProvider- Throws:
IOException
-
createLink
- Overrides:
createLinkin classFileSystemProvider- Throws:
IOException
-
delete
- Specified by:
deletein classFileSystemProvider- Throws:
IOException
-
deleteIfExists
- Overrides:
deleteIfExistsin classFileSystemProvider- Throws:
IOException
-
readSymbolicLink
- Overrides:
readSymbolicLinkin classFileSystemProvider- Throws:
IOException
-
copy
- Specified by:
copyin classFileSystemProvider- Throws:
IOException
-
move
- Specified by:
movein classFileSystemProvider- Throws:
IOException
-
isSameFile
- Specified by:
isSameFilein classFileSystemProvider- Throws:
IOException
-
isHidden
- Specified by:
isHiddenin classFileSystemProvider- Throws:
IOException
-
getFileStore
- Specified by:
getFileStorein classFileSystemProvider- Throws:
IOException
-
getFileSystem
- Throws:
FileSystemNotFoundException
-
checkAccess
- 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
-
provider
-
root
-
unroot
- Parameters:
path- The original (rooted)Path- Returns:
- The actual absolute local
Pathrepresented by the rooted one - Throws:
IllegalArgumentException- ifnullpath argumentProviderMismatchException- if not aRootedPath- See Also:
-
resolveLocalPath
- Parameters:
path- The originalRootedPath- nevernull- Returns:
- The actual absolute local
Pathrepresented by the rooted one - Throws:
InvalidPathException- If the resolved path is not a proper sub-path of the rooted file system
-
translateIoException
-
fixExceptionFileName
-