Class BufferAllocator

java.lang.Object
com.google.protobuf.BufferAllocator

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

  • Constructor Details

    • BufferAllocator

      BufferAllocator()
  • Method Details

    • 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.