Package com.soulfiremc.server.script
Class SandboxedFileSystem
java.lang.Object
com.soulfiremc.server.script.SandboxedFileSystem
- All Implemented Interfaces:
org.graalvm.polyglot.io.FileSystem
Sandboxed file system for scripts.
Scripts can only access files within their own directory or subdirectories.
The scheme is forced to be UNIX, and the root is the script's directory.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.graalvm.polyglot.io.FileSystem
org.graalvm.polyglot.io.FileSystem.Selector
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkAccess
(Path path, Set<? extends AccessMode> modes, LinkOption... linkOptions) void
copy
(Path source, Path target, CopyOption... options) void
createDirectory
(Path dir, FileAttribute<?>... attrs) void
createLink
(Path link, Path existing) void
createSymbolicLink
(Path link, Path target, FileAttribute<?>... attrs) void
getEncoding
(Path path) getMimeType
(Path path) boolean
isSameFile
(Path path1, Path path2, LinkOption... options) void
move
(Path source, Path target, CopyOption... options) newByteChannel
(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) newDirectoryStream
(Path dir, DirectoryStream.Filter<? super Path> filter) readAttributes
(Path path, String attributes, LinkOption... options) readSymbolicLink
(Path link) void
setAttribute
(Path path, String attribute, Object value, LinkOption... options) void
setCurrentWorkingDirectory
(Path currentWorkingDirectory) toAbsolutePath
(Path path) toRealPath
(Path path, LinkOption... linkOptions)
-
Constructor Details
-
SandboxedFileSystem
-
-
Method Details
-
parsePath
- Specified by:
parsePath
in interfaceorg.graalvm.polyglot.io.FileSystem
-
parsePath
- Specified by:
parsePath
in interfaceorg.graalvm.polyglot.io.FileSystem
-
checkAccess
public void checkAccess(Path path, Set<? extends AccessMode> modes, LinkOption... linkOptions) throws IOException - Specified by:
checkAccess
in interfaceorg.graalvm.polyglot.io.FileSystem
- Throws:
IOException
-
createDirectory
- Specified by:
createDirectory
in interfaceorg.graalvm.polyglot.io.FileSystem
- Throws:
IOException
-
delete
- Specified by:
delete
in interfaceorg.graalvm.polyglot.io.FileSystem
- Throws:
IOException
-
newByteChannel
public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException - Specified by:
newByteChannel
in interfaceorg.graalvm.polyglot.io.FileSystem
- Throws:
IOException
-
newDirectoryStream
public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) throws IOException - Specified by:
newDirectoryStream
in interfaceorg.graalvm.polyglot.io.FileSystem
- Throws:
IOException
-
toAbsolutePath
- Specified by:
toAbsolutePath
in interfaceorg.graalvm.polyglot.io.FileSystem
-
toRealPath
- Specified by:
toRealPath
in interfaceorg.graalvm.polyglot.io.FileSystem
- Throws:
IOException
-
readAttributes
public Map<String,Object> readAttributes(Path path, String attributes, LinkOption... options) throws IOException - Specified by:
readAttributes
in interfaceorg.graalvm.polyglot.io.FileSystem
- Throws:
IOException
-
setAttribute
public void setAttribute(Path path, String attribute, Object value, LinkOption... options) throws IOException - Specified by:
setAttribute
in interfaceorg.graalvm.polyglot.io.FileSystem
- Throws:
IOException
-
copy
- Specified by:
copy
in interfaceorg.graalvm.polyglot.io.FileSystem
- Throws:
IOException
-
move
- Specified by:
move
in interfaceorg.graalvm.polyglot.io.FileSystem
- Throws:
IOException
-
createLink
- Specified by:
createLink
in interfaceorg.graalvm.polyglot.io.FileSystem
- Throws:
IOException
-
createSymbolicLink
public void createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs) throws IOException - Specified by:
createSymbolicLink
in interfaceorg.graalvm.polyglot.io.FileSystem
- Throws:
IOException
-
readSymbolicLink
- Specified by:
readSymbolicLink
in interfaceorg.graalvm.polyglot.io.FileSystem
- Throws:
IOException
-
setCurrentWorkingDirectory
- Specified by:
setCurrentWorkingDirectory
in interfaceorg.graalvm.polyglot.io.FileSystem
-
getSeparator
- Specified by:
getSeparator
in interfaceorg.graalvm.polyglot.io.FileSystem
-
getPathSeparator
- Specified by:
getPathSeparator
in interfaceorg.graalvm.polyglot.io.FileSystem
-
getMimeType
- Specified by:
getMimeType
in interfaceorg.graalvm.polyglot.io.FileSystem
-
getEncoding
- Specified by:
getEncoding
in interfaceorg.graalvm.polyglot.io.FileSystem
-
getTempDirectory
- Specified by:
getTempDirectory
in interfaceorg.graalvm.polyglot.io.FileSystem
-
isSameFile
- Specified by:
isSameFile
in interfaceorg.graalvm.polyglot.io.FileSystem
- Throws:
IOException
-