Package org.apache.mina.common
Class SimpleByteBufferAllocator
- java.lang.Object
-
- org.apache.mina.common.SimpleByteBufferAllocator
-
- All Implemented Interfaces:
ByteBufferAllocator
public class SimpleByteBufferAllocator extends java.lang.Object implements ByteBufferAllocator
A simplisticByteBufferAllocator
which simply allocates a new buffer every time.
-
-
Constructor Summary
Constructors Constructor Description SimpleByteBufferAllocator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 NIOByteBuffer
into MINA buffer.
-
-
-
Method Detail
-
allocate
public ByteBuffer allocate(int capacity, boolean direct)
Description copied from interface:ByteBufferAllocator
Returns the buffer which is capable of the specified size.- Specified by:
allocate
in interfaceByteBufferAllocator
- Parameters:
capacity
- the capacity of the bufferdirect
- true to get a direct buffer, false to get a heap buffer.
-
wrap
public ByteBuffer wrap(java.nio.ByteBuffer nioBuffer)
Description copied from interface:ByteBufferAllocator
Wraps the specified NIOByteBuffer
into MINA buffer.- Specified by:
wrap
in interfaceByteBufferAllocator
-
dispose
public void dispose()
Description copied from interface:ByteBufferAllocator
Dispose of this allocator.- Specified by:
dispose
in interfaceByteBufferAllocator
-
-