org.apache.mina.common
Interface ByteBufferAllocator
- PooledByteBufferAllocator, SimpleByteBufferAllocator
public interface ByteBufferAllocator
Allocates
ByteBuffer
s and manages them. Please implement this
interface if you need more advanced memory management scheme.
ByteBuffer | allocate(int capacity, boolean direct) - Returns the buffer which is capable of the specified size.
|
void | dispose() - Dispose of this allocator.
|
ByteBuffer | wrap(java.nio.ByteBuffer nioBuffer) - Wraps the specified NIO
java.nio.ByteBuffer into MINA buffer.
|
allocate
public ByteBuffer allocate(int capacity,
boolean direct)
Returns the buffer which is capable of the specified size.
capacity
- the capacity of the bufferdirect
- true to get a direct buffer,
false to get a heap buffer.
dispose
public void dispose()
Dispose of this allocator.
wrap
public ByteBuffer wrap(java.nio.ByteBuffer nioBuffer)
Wraps the specified NIO java.nio.ByteBuffer
into MINA buffer.