-
- Type Parameters:
B- the buffer type
public interface BufferAllocator<B extends java.nio.Buffer>A simple allocator for buffers.- Author:
- David M. Lloyd
-
-
Field Summary
Fields Modifier and Type Field Description static BufferAllocator<java.nio.ByteBuffer>BYTE_BUFFER_ALLOCATORA simple allocator for heap-array-backed byte buffers.static BufferAllocator<java.nio.ByteBuffer>DIRECT_BYTE_BUFFER_ALLOCATORA simple allocator for direct byte buffers.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Ballocate(int size)Allocate a buffer of the given size.
-
-
-
Field Detail
-
BYTE_BUFFER_ALLOCATOR
static final BufferAllocator<java.nio.ByteBuffer> BYTE_BUFFER_ALLOCATOR
A simple allocator for heap-array-backed byte buffers.
-
DIRECT_BYTE_BUFFER_ALLOCATOR
static final BufferAllocator<java.nio.ByteBuffer> DIRECT_BYTE_BUFFER_ALLOCATOR
A simple allocator for direct byte buffers.
-
-
Method Detail
-
allocate
B allocate(int size) throws java.lang.IllegalArgumentException
Allocate a buffer of the given size.- Parameters:
size- the size- Returns:
- the buffer
- Throws:
java.lang.IllegalArgumentException- if the given buffer size is less than zero
-
-