Class BufferAllocator


  • @CheckReturnValue
    @ExperimentalApi
    abstract class BufferAllocator
    extends java.lang.Object
    An object responsible for allocation of buffers. This is an extension point to enable buffer pooling within an application.
    • Constructor Detail

      • BufferAllocator

        BufferAllocator()
    • Method Detail

      • unpooled

        public static BufferAllocator unpooled()
        Returns an unpooled buffer allocator, which will create a new buffer for each request.
      • allocateHeapBuffer

        public abstract AllocatedBuffer allocateHeapBuffer​(int capacity)
        Allocates a buffer with the given capacity that is backed by an array on the heap.
      • allocateDirectBuffer

        public abstract AllocatedBuffer allocateDirectBuffer​(int capacity)
        Allocates a direct (i.e. non-heap) buffer with the given capacity.