Package com.google.protobuf
Class BufferAllocator
- java.lang.Object
-
- com.google.protobuf.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.
-
-
Field Summary
Fields Modifier and Type Field Description private static BufferAllocator
UNPOOLED
-
Constructor Summary
Constructors Constructor Description BufferAllocator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract AllocatedBuffer
allocateDirectBuffer(int capacity)
Allocates a direct (i.e.abstract AllocatedBuffer
allocateHeapBuffer(int capacity)
Allocates a buffer with the given capacity that is backed by an array on the heap.static BufferAllocator
unpooled()
Returns an unpooled buffer allocator, which will create a new buffer for each request.
-
-
-
Field Detail
-
UNPOOLED
private static final BufferAllocator UNPOOLED
-
-
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.
-
-