Package org.apache.mina.common
Interface ByteBufferAllocator
- All Known Implementing Classes:
PooledByteBufferAllocator
,SimpleByteBufferAllocator
public interface ByteBufferAllocator
Allocates
ByteBuffer
s 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.void
dispose()
Dispose of this allocator.wrap
(ByteBuffer nioBuffer) Wraps the specified NIOByteBuffer
into MINA buffer.
-
Method Details
-
allocate
Returns the buffer which is capable of the specified size.- Parameters:
capacity
- the capacity of the bufferdirect
- true to get a direct buffer, false to get a heap buffer.
-
wrap
Wraps the specified NIOByteBuffer
into MINA buffer. -
dispose
void dispose()Dispose of this allocator.
-