Class SimpleBufferAllocator
java.lang.Object
org.apache.mina.core.buffer.SimpleBufferAllocator
- All Implemented Interfaces:
IoBufferAllocator
A simplistic
IoBufferAllocator which simply allocates a new
buffer every time.-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallocate(int capacity, boolean direct) Returns the buffer which is capable of the specified size.allocateNioBuffer(int capacity, boolean direct) Returns the NIO buffer which is capable of the specified size.voiddispose()Dispose of this allocator.wrap(ByteBuffer nioBuffer) Wraps the specified NIOByteBufferinto MINA buffer.
-
Constructor Details
-
SimpleBufferAllocator
public SimpleBufferAllocator()
-
-
Method Details
-
allocate
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
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
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
-