Interface CleanableDirectBuffer


  • public interface CleanableDirectBuffer
    Encapsulates a direct ByteBuffer and its mechanism for immediate deallocation, if any.
    • Method Detail

      • buffer

        java.nio.ByteBuffer buffer()
        Get the buffer instance.

        Note: the buffer must not be accessed after the clean() method has been called.

        Returns:
        The ByteBuffer instance.
      • clean

        void clean()
        Deallocate the buffer. This method can only be called once per instance, and all usages of the buffer must have ceased before this method is called, and the buffer must not be accessed again after this method has been called.
      • hasMemoryAddress

        default boolean hasMemoryAddress()
        Returns:
        true if the native memory address is available, otherwise false.
      • memoryAddress

        default long memoryAddress()
        Get the native memory address, but only if hasMemoryAddress() returns true, otherwise this may return an unspecified value or throw an exception.
        Returns:
        The native memory address of this buffer, if available.