- Type Parameters:
B
- the buffer type
public interface BufferAllocator<B extends Buffer>
A simple allocator for buffers.
- Author:
- David M. Lloyd
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BufferAllocator
<ByteBuffer> A simple allocator for heap-array-backed byte buffers.static final BufferAllocator
<ByteBuffer> A simple allocator for direct byte buffers. -
Method Summary
-
Field Details
-
BYTE_BUFFER_ALLOCATOR
A simple allocator for heap-array-backed byte buffers. -
DIRECT_BYTE_BUFFER_ALLOCATOR
A simple allocator for direct byte buffers.
-
-
Method Details
-
allocate
Allocate a buffer of the given size.- Parameters:
size
- the size- Returns:
- the buffer
- Throws:
IllegalArgumentException
- if the given buffer size is less than zero
-