public class SimpleBufferAllocator extends 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.
|
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(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.IoBuffer
public 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.ByteBuffer
public IoBuffer wrap(ByteBuffer nioBuffer)
IoBufferAllocator
ByteBuffer
into MINA buffer.wrap
in interface IoBufferAllocator
nioBuffer
- The ByteBuffer
to wrapIoBuffer
wrapping the ByteBuffer
public void dispose()
IoBufferAllocator
dispose
in interface IoBufferAllocator
Copyright © 2004–2018 Apache MINA Project. All rights reserved.