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 TypeMethodDescriptionvoidcheckAccess(Path path, Set<? extends AccessMode> modes, LinkOption... linkOptions) voidcopy(Path source, Path target, CopyOption... options) voidcreateDirectory(Path dir, FileAttribute<?>... attrs) voidcreateLink(Path link, Path existing) voidcreateSymbolicLink(Path link, Path target, FileAttribute<?>... attrs) voidgetEncoding(Path path) getMimeType(Path path) booleanisSameFile(Path path1, Path path2, LinkOption... options) voidmove(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) voidsetAttribute(Path path, String attribute, Object value, LinkOption... options) voidsetCurrentWorkingDirectory(Path currentWorkingDirectory) toAbsolutePath(Path path) toRealPath(Path path, LinkOption... linkOptions) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.graalvm.polyglot.io.FileSystem
getFileStoreBlockSize, getFileStoreTotalSpace, getFileStoreUnallocatedSpace, getFileStoreUsableSpace, isFileStoreReadOnly
-
Constructor Details
-
SandboxedFileSystem
-
-
Method Details
-
parsePath
-
parsePath
-
checkAccess
public void checkAccess(Path path, Set<? extends AccessMode> modes, LinkOption... linkOptions) throws IOException - Specified by:
checkAccessin interfaceorg.graalvm.polyglot.io.FileSystem- Throws:
IOException
-
createDirectory
- Specified by:
createDirectoryin interfaceorg.graalvm.polyglot.io.FileSystem- Throws:
IOException
-
delete
- Specified by:
deletein interfaceorg.graalvm.polyglot.io.FileSystem- Throws:
IOException
-
newByteChannel
public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException - Specified by:
newByteChannelin interfaceorg.graalvm.polyglot.io.FileSystem- Throws:
IOException
-
newDirectoryStream
public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) throws IOException - Specified by:
newDirectoryStreamin interfaceorg.graalvm.polyglot.io.FileSystem- Throws:
IOException
-
toAbsolutePath
-
toRealPath
- Specified by:
toRealPathin interfaceorg.graalvm.polyglot.io.FileSystem- Throws:
IOException
-
readAttributes
public Map<String,Object> readAttributes(Path path, String attributes, LinkOption... options) throws IOException - Specified by:
readAttributesin interfaceorg.graalvm.polyglot.io.FileSystem- Throws:
IOException
-
setAttribute
public void setAttribute(Path path, String attribute, Object value, LinkOption... options) throws IOException - Specified by:
setAttributein interfaceorg.graalvm.polyglot.io.FileSystem- Throws:
IOException
-
copy
- Specified by:
copyin interfaceorg.graalvm.polyglot.io.FileSystem- Throws:
IOException
-
move
- Specified by:
movein interfaceorg.graalvm.polyglot.io.FileSystem- Throws:
IOException
-
createLink
- Specified by:
createLinkin interfaceorg.graalvm.polyglot.io.FileSystem- Throws:
IOException
-
createSymbolicLink
public void createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs) throws IOException - Specified by:
createSymbolicLinkin interfaceorg.graalvm.polyglot.io.FileSystem- Throws:
IOException
-
readSymbolicLink
- Specified by:
readSymbolicLinkin interfaceorg.graalvm.polyglot.io.FileSystem- Throws:
IOException
-
setCurrentWorkingDirectory
- Specified by:
setCurrentWorkingDirectoryin interfaceorg.graalvm.polyglot.io.FileSystem
-
getSeparator
- Specified by:
getSeparatorin interfaceorg.graalvm.polyglot.io.FileSystem
-
getPathSeparator
- Specified by:
getPathSeparatorin interfaceorg.graalvm.polyglot.io.FileSystem
-
getMimeType
-
getEncoding
-
getTempDirectory
- Specified by:
getTempDirectoryin interfaceorg.graalvm.polyglot.io.FileSystem
-
isSameFile
- Specified by:
isSameFilein interfaceorg.graalvm.polyglot.io.FileSystem- Throws:
IOException
-