Class AbstractNativeProxy

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected NativeHandle nativeHandle
      A handle to the native object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected long getNativeHandle()
      Returns a handle to the native object if it may be safely used to access the native object.
      protected boolean isValidHandle()
      Returns true if this proxy has a valid native handle.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • nativeHandle

        protected final NativeHandle nativeHandle
        A handle to the native object.
    • Constructor Detail

      • AbstractNativeProxy

        protected AbstractNativeProxy​(NativeHandle nativeHandle)
    • Method Detail

      • getNativeHandle

        protected long getNativeHandle()
        Returns a handle to the native object if it may be safely used to access the native object. Equivalent to nativeHandle.get().

        The returned value shall only be passed as an argument to native methods.

        Warning: do not cache the return value, as you won't be able to catch use-after-free.

        Throws:
        java.lang.IllegalStateException - if the native handle is invalid (closed or nullptr)
      • isValidHandle

        protected final boolean isValidHandle()
        Returns true if this proxy has a valid native handle.