Package com.google.code.yanf4j.buffer
Class SimpleBufferAllocator
java.lang.Object
com.google.code.yanf4j.buffer.SimpleBufferAllocator
- All Implemented Interfaces:
IoBufferAllocator
A simplistic
IoBufferAllocator which simply allocates a new buffer every time.- Version:
- $Rev: 671827 $, $Date: 2008-06-26 10:49:48 +0200 (Thu, 26 Jun 2008) $
-
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- true to get a direct buffer, false to get a heap buffer.
-
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- true to get a direct buffer, false to get a heap buffer.
-
wrap
Description copied from interface:IoBufferAllocatorWraps the specified NIOByteBufferinto MINA buffer.- Specified by:
wrapin interfaceIoBufferAllocator
-
dispose
public void dispose()Description copied from interface:IoBufferAllocatorDispose of this allocator.- Specified by:
disposein interfaceIoBufferAllocator
-