Class IOAccess.Builder

java.lang.Object
org.graalvm.polyglot.io.IOAccess.Builder
Enclosing class:
IOAccess

public static final class IOAccess.Builder extends Object
Builder to create a custom IO access configuration.
Since:
23.0
  • Method Details

    • allowHostFileAccess

      public IOAccess.Builder allowHostFileAccess(boolean allow)
      If true, it allows the guest language unrestricted access to files on the host system.
      Since:
      23.0
    • allowHostSocketAccess

      public IOAccess.Builder allowHostSocketAccess(boolean allow)
      If true, it allows the guest language unrestricted access to host system sockets.
      Since:
      23.0
    • fileSystem

      public IOAccess.Builder fileSystem(FileSystem fileSystem)
      Sets a new FileSystem. Access to the file system in the guest language will be virtualized using the fileSystem. A file system can restrict access to files or fully virtualize file system operations. An example of virtualization is a memory-based file system.

      GraalVM trusts a custom file system supplied by the embedder. Its methods may be invoked with guest-controlled input, so the embedder must ensure that the implementation is safe for use with the selected sandbox policy. Sandbox validation rejects file systems known to expose the default host file system, but it does not inspect the behavior of arbitrary custom implementations.

      Parameters:
      fileSystem - the file system to use in the guest language
      Returns:
      the IOAccess.Builder
      Since:
      23.0
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Since:
      25.3
    • build

      public IOAccess build()
      Creates an instance of the custom IO access configuration.
      Throws:
      IllegalArgumentException - if host file access is enabled and a custom file system is set.
      Since:
      23.0