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 TypeMethodDescriptionvoid
checkAccess
(Path path, AccessMode... modes) void
copy
(Path source, Path target, CopyOption... options) void
createDirectory
(Path dir, FileAttribute<?>... attrs) void
createLink
(Path link, Path existing) protected void
createLink
(Path link, Path target, boolean symLink, FileAttribute<?>... attrs) void
createSymbolicLink
(Path link, Path target, FileAttribute<?>... attrs) void
boolean
deleteIfExists
(Path path) private static Path
ensureDirectory
(Path path) <V extends FileAttributeView>
VgetFileAttributeView
(Path path, Class<V> type, LinkOption... options) getFileStore
(Path path) getFileSystem
(URI uri) protected RootedFileSystem
getFileSystem
(Path path) boolean
boolean
isSameFile
(Path path, Path path2) void
move
(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 FileSystem
newFileSystem
(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 Path
resolveLocalPath
(RootedPath path) protected DirectoryStream<Path>
root
(RootedFileSystem rfs, DirectoryStream<Path> ds) protected Path
root
(RootedFileSystem rfs, Path nat) root
(RootedFileSystem rfs, Iterator<Path> iter) void
setAttribute
(Path path, String attribute, Object value, LinkOption... options) protected Path
protected Path
Methods 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:
getScheme
in classFileSystemProvider
-
newFileSystem
- Specified by:
newFileSystem
in classFileSystemProvider
- Throws:
IOException
-
getFileSystem
- Specified by:
getFileSystem
in classFileSystemProvider
-
newFileSystem
- Overrides:
newFileSystem
in classFileSystemProvider
- Throws:
IOException
-
newFileSystem
- Throws:
IOException
-
uriToPath
-
ensureDirectory
-
getPath
- Specified by:
getPath
in classFileSystemProvider
-
newInputStream
- Overrides:
newInputStream
in classFileSystemProvider
- Throws:
IOException
-
newOutputStream
- Overrides:
newOutputStream
in classFileSystemProvider
- Throws:
IOException
-
newFileChannel
public FileChannel newFileChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException - Overrides:
newFileChannel
in classFileSystemProvider
- Throws:
IOException
-
newAsynchronousFileChannel
public AsynchronousFileChannel newAsynchronousFileChannel(Path path, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs) throws IOException - Overrides:
newAsynchronousFileChannel
in classFileSystemProvider
- Throws:
IOException
-
newByteChannel
public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException - Specified by:
newByteChannel
in classFileSystemProvider
- Throws:
IOException
-
newDirectoryStream
public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) throws IOException - Specified by:
newDirectoryStream
in classFileSystemProvider
- Throws:
IOException
-
root
-
root
-
createDirectory
- Specified by:
createDirectory
in classFileSystemProvider
- Throws:
IOException
-
createSymbolicLink
public void createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs) throws IOException - Overrides:
createSymbolicLink
in classFileSystemProvider
- Throws:
IOException
-
createLink
- Overrides:
createLink
in classFileSystemProvider
- Throws:
IOException
-
createLink
protected void createLink(Path link, Path target, boolean symLink, FileAttribute<?>... attrs) throws IOException - Throws:
IOException
-
delete
- Specified by:
delete
in classFileSystemProvider
- Throws:
IOException
-
deleteIfExists
- Overrides:
deleteIfExists
in classFileSystemProvider
- Throws:
IOException
-
readSymbolicLink
- Overrides:
readSymbolicLink
in classFileSystemProvider
- Throws:
IOException
-
copy
- Specified by:
copy
in classFileSystemProvider
- Throws:
IOException
-
move
- Specified by:
move
in classFileSystemProvider
- Throws:
IOException
-
isSameFile
- Specified by:
isSameFile
in classFileSystemProvider
- Throws:
IOException
-
isHidden
- Specified by:
isHidden
in classFileSystemProvider
- Throws:
IOException
-
getFileStore
- Specified by:
getFileStore
in classFileSystemProvider
- Throws:
IOException
-
getFileSystem
- Throws:
FileSystemNotFoundException
-
checkAccess
- Specified by:
checkAccess
in classFileSystemProvider
- Throws:
IOException
-
getFileAttributeView
public <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options) - Specified by:
getFileAttributeView
in classFileSystemProvider
-
readAttributes
public <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options) throws IOException - Specified by:
readAttributes
in classFileSystemProvider
- Throws:
IOException
-
readAttributes
public Map<String,Object> readAttributes(Path path, String attributes, LinkOption... options) throws IOException - Specified by:
readAttributes
in classFileSystemProvider
- Throws:
IOException
-
setAttribute
public void setAttribute(Path path, String attribute, Object value, LinkOption... options) throws IOException - Specified by:
setAttribute
in classFileSystemProvider
- Throws:
IOException
-
provider
-
root
-
unroot
- Parameters:
path
- The original (rooted)Path
- Returns:
- The actual absolute local
Path
represented by the rooted one - Throws:
IllegalArgumentException
- ifnull
path argumentProviderMismatchException
- if not aRootedPath
- See Also:
-
resolveLocalPath
- Parameters:
path
- The originalRootedPath
- nevernull
- Returns:
- The actual absolute local
Path
represented by the rooted one - Throws:
InvalidPathException
- If the resolved path is not a proper sub-path of the rooted file system
-