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.void
dispose()
Dispose of this allocator.wrap
(ByteBuffer nioBuffer) Wraps the specified NIOByteBuffer
into MINA buffer.
-
Constructor Details
-
SimpleBufferAllocator
public SimpleBufferAllocator()
-
-
Method Details
-
allocate
Description copied from interface:IoBufferAllocator
Returns the buffer which is capable of the specified size.- Specified by:
allocate
in 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:IoBufferAllocator
Returns the NIO buffer which is capable of the specified size.- Specified by:
allocateNioBuffer
in 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:IoBufferAllocator
Wraps the specified NIOByteBuffer
into MINA buffer.- Specified by:
wrap
in interfaceIoBufferAllocator
-
dispose
public void dispose()Description copied from interface:IoBufferAllocator
Dispose of this allocator.- Specified by:
dispose
in interfaceIoBufferAllocator
-