Class WhisperJNI.WhisperJNIPointer

java.lang.Object
io.github.givimad.whisperjni.WhisperJNI.WhisperJNIPointer
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
WhisperContext, WhisperGrammar, WhisperState
Enclosing class:
WhisperJNI

protected abstract static class WhisperJNI.WhisperJNIPointer extends Object implements AutoCloseable
In order to avoid sharing pointers between the c++ and java, we use this util base class which holds a random integer id generated in the whisper.cpp wrapper.
Author:
Miguel Álvarez Díez - Initial contribution
  • Field Details

    • ref

      protected final int ref
      Native pointer reference identifier.
  • Constructor Details

    • WhisperJNIPointer

      protected WhisperJNIPointer(int ref)
      Creates a new object used to represent a struct pointer on the native library.
      Parameters:
      ref - a random integer id generated by the native wrapper
  • Method Details

    • assertAvailable

      protected static void assertAvailable(WhisperJNI.WhisperJNIPointer pointer)
      Asserts the provided pointer is still available.
      Parameters:
      pointer - a WhisperJNI.WhisperJNIPointer instance representing a pointer.
    • isReleased

      protected boolean isReleased()
      Return true if native memory is free
      Returns:
      a boolean indicating if the native data was already released
    • release

      protected void release()
      Mark the point as released