|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ByteBufferAllocator
A byte buffer allocator simple allocates byte buffers, and handles releasing them. Implementation can include special direct buffer cleaning when releasing a buffer, as well as caching of byte buffers.
There are two types of buffers that can be allocated, small and big. This comes in handy when knowing in advance (more or less) the size of the buffers needed (large files or small), as well as in caching implementations.
Nested Class Summary | |
---|---|
static class |
ByteBufferAllocator.Cleaner
Helper class to allocator implementations allowing to clean direct buffers. |
static class |
ByteBufferAllocator.Type
|
Method Summary | |
---|---|
java.nio.ByteBuffer |
allocate(ByteBufferAllocator.Type type)
Allocate a byte buffer for the specific type. |
void |
close()
Close the allocator, releasing any cached buffers for example. |
void |
release(java.nio.ByteBuffer buffer)
Release the buffer. |
int |
sizeInBytes(ByteBufferAllocator.Type type)
The size (in bytes) that is allocated for the provided type. |
Method Detail |
---|
int sizeInBytes(ByteBufferAllocator.Type type)
java.nio.ByteBuffer allocate(ByteBufferAllocator.Type type) throws java.io.IOException
java.io.IOException
void release(java.nio.ByteBuffer buffer)
void close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |