Class ArenaResourceManager.ManagedNativeResource

java.lang.Object
ai.tegmentum.wasmtime4j.panama.ArenaResourceManager.ManagedNativeResource
All Implemented Interfaces:
AutoCloseable
Enclosing class:
ArenaResourceManager

public static final class ArenaResourceManager.ManagedNativeResource extends Object implements AutoCloseable
Managed native resource that tracks its lifecycle.
  • Method Details

    • resource

      public MemorySegment resource()
      Gets the native pointer.
      Returns:
      the native pointer
      Throws:
      IllegalStateException - if the resource is closed
    • getDescription

      public String getDescription()
      Gets the description of this managed resource.
      Returns:
      the description
    • isValid

      public boolean isValid()
      Checks if the resource is valid (not closed).
      Returns:
      true if valid, false if closed
    • close

      public void close()
      Closes the native resource.
      Specified by:
      close in interface AutoCloseable
    • toString

      public String toString()
      Overrides:
      toString in class Object