public class SimpleBufferAllocator extends java.lang.Object implements IoBufferAllocator
IoBufferAllocator
which simply allocates a new
buffer every time.Constructor and Description |
---|
SimpleBufferAllocator() |
Modifier and Type | Method and Description |
---|---|
IoBuffer |
allocate(int capacity,
boolean direct)
Returns the buffer which is capable of the specified size.
|
java.nio.ByteBuffer |
allocateNioBuffer(int capacity,
boolean direct)
Returns the NIO buffer which is capable of the specified size.
|
void |
dispose()
Dispose of this allocator.
|
IoBuffer |
wrap(java.nio.ByteBuffer nioBuffer)
Wraps the specified NIO
ByteBuffer into MINA buffer. |
public IoBuffer allocate(int capacity, boolean direct)
IoBufferAllocator
allocate
in interface IoBufferAllocator
capacity
- the capacity of the bufferdirect
- true to get a direct buffer,
false to get a heap buffer.public java.nio.ByteBuffer allocateNioBuffer(int capacity, boolean direct)
IoBufferAllocator
allocateNioBuffer
in interface IoBufferAllocator
capacity
- the capacity of the bufferdirect
- true to get a direct buffer,
false to get a heap buffer.public IoBuffer wrap(java.nio.ByteBuffer nioBuffer)
IoBufferAllocator
ByteBuffer
into MINA buffer.wrap
in interface IoBufferAllocator
public void dispose()
IoBufferAllocator
dispose
in interface IoBufferAllocator
Copyright © 2004-2019 Apache MINA Project. All Rights Reserved.