Interface LeasedByteBuffer

All Superinterfaces:
AutoCloseable

public sealed interface LeasedByteBuffer extends AutoCloseable
A ByteBuffer leased from a BufferAllocator.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Returns the leased byte buffer to the buffer allocator it was obtained from.
    get()
    Gets the leased byte buffer.
  • Method Details

    • get

      ByteBuffer get()

      Gets the leased byte buffer.

      Continued use of a closed byte buffer can result in data corruption.

      Returns:
      the leased byte buffer
      Throws:
      IllegalStateException - if close() has already been called
    • close

      void close()

      Returns the leased byte buffer to the buffer allocator it was obtained from.

      Subsequent calls to this method have no effect. Calling get() after calling this method will throw IllegalStateException.

      Specified by:
      close in interface AutoCloseable