Interface IoBufferAllocator
- All Known Implementing Classes:
CachedBufferAllocator, SimpleBufferAllocator
public interface IoBufferAllocator
Allocates
IoBuffers and manages them. Please implement this
interface if you need more advanced memory management scheme.-
Method Summary
Modifier and TypeMethodDescriptionallocate(int capacity, boolean direct) Returns the buffer which is capable of the specified size.allocateNioBuffer(int capacity, boolean direct) Returns the NIO buffer which is capable of the specified size.voiddispose()Dispose of this allocator.wrap(ByteBuffer nioBuffer) Wraps the specified NIOByteBufferinto MINA buffer.
-
Method Details
-
allocate
-
allocateNioBuffer
Returns the NIO buffer which is capable of the specified size.- Parameters:
capacity- the capacity of the bufferdirect-trueto get a direct buffer,falseto get a heap buffer.- Returns:
- The allocated
ByteBuffer
-
wrap
Wraps the specified NIOByteBufferinto MINA buffer.- Parameters:
nioBuffer- TheByteBufferto wrap- Returns:
- The
IoBufferwrapping theByteBuffer
-
dispose
void dispose()Dispose of this allocator.
-