Package org.apache.mina.core.buffer
Class SimpleBufferAllocator
- java.lang.Object
-
- org.apache.mina.core.buffer.SimpleBufferAllocator
-
- All Implemented Interfaces:
IoBufferAllocator
public class SimpleBufferAllocator extends Object implements IoBufferAllocator
A simplisticIoBufferAllocatorwhich simply allocates a new buffer every time.- Author:
- Apache MINA Project
-
-
Constructor Summary
Constructors Constructor Description SimpleBufferAllocator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IoBufferallocate(int capacity, boolean direct)Returns the buffer which is capable of the specified size.ByteBufferallocateNioBuffer(int capacity, boolean direct)Returns the NIO buffer which is capable of the specified size.voiddispose()Dispose of this allocator.IoBufferwrap(ByteBuffer nioBuffer)Wraps the specified NIOByteBufferinto MINA buffer.
-
-
-
Method Detail
-
allocate
public IoBuffer allocate(int capacity, boolean direct)
Description copied from interface:IoBufferAllocatorReturns the buffer which is capable of the specified size.- Specified by:
allocatein interfaceIoBufferAllocator- Parameters:
capacity- the capacity of the bufferdirect-trueto get a direct buffer,falseto get a heap buffer.- Returns:
- The allocated
IoBuffer
-
allocateNioBuffer
public ByteBuffer allocateNioBuffer(int capacity, boolean direct)
Description copied from interface:IoBufferAllocatorReturns the NIO buffer which is capable of the specified size.- Specified by:
allocateNioBufferin interfaceIoBufferAllocator- Parameters:
capacity- the capacity of the bufferdirect-trueto get a direct buffer,falseto get a heap buffer.- Returns:
- The allocated
ByteBuffer
-
wrap
public IoBuffer wrap(ByteBuffer nioBuffer)
Description copied from interface:IoBufferAllocatorWraps the specified NIOByteBufferinto MINA buffer.- Specified by:
wrapin interfaceIoBufferAllocator- Parameters:
nioBuffer- TheByteBufferto wrap- Returns:
- The
IoBufferwrapping theByteBuffer
-
dispose
public void dispose()
Description copied from interface:IoBufferAllocatorDispose of this allocator.- Specified by:
disposein interfaceIoBufferAllocator
-
-