Class PanamaWasiEnvironment

java.lang.Object
ai.tegmentum.wasmtime4j.panama.wasi.cli.PanamaWasiEnvironment
All Implemented Interfaces:
ai.tegmentum.wasmtime4j.wasi.cli.WasiEnvironment

public final class PanamaWasiEnvironment extends Object implements ai.tegmentum.wasmtime4j.wasi.cli.WasiEnvironment
Panama FFI implementation of the WasiEnvironment interface.

This class provides access to WASI Preview 2 environment and command-line operations through Panama Foreign Function API calls to the native Wasmtime library.

This implementation ensures defensive programming to prevent native resource leaks and JVM crashes.

Since:
1.0.0
  • Constructor Details

    • PanamaWasiEnvironment

      public PanamaWasiEnvironment(MemorySegment contextHandle)
      Creates a new Panama WASI environment with the given native context handle.
      Parameters:
      contextHandle - the native context handle
      Throws:
      IllegalArgumentException - if context handle is null
  • Method Details

    • getEnvironmentVariables

      public Map<String,String> getEnvironmentVariables()
      Specified by:
      getEnvironmentVariables in interface ai.tegmentum.wasmtime4j.wasi.cli.WasiEnvironment
    • getVariable

      public Optional<String> getVariable(String name)
      Specified by:
      getVariable in interface ai.tegmentum.wasmtime4j.wasi.cli.WasiEnvironment
    • getArguments

      public List<String> getArguments()
      Specified by:
      getArguments in interface ai.tegmentum.wasmtime4j.wasi.cli.WasiEnvironment
    • getInitialCwd

      public Optional<String> getInitialCwd()
      Specified by:
      getInitialCwd in interface ai.tegmentum.wasmtime4j.wasi.cli.WasiEnvironment