Package com.google.code.yanf4j.buffer
Class SimpleBufferAllocator
- java.lang.Object
-
- com.google.code.yanf4j.buffer.SimpleBufferAllocator
-
- All Implemented Interfaces:
IoBufferAllocator
public class SimpleBufferAllocator extends java.lang.Object implements IoBufferAllocator
A simplisticIoBufferAllocator
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 Modifier and Type Class Description private class
SimpleBufferAllocator.SimpleBuffer
-
Constructor Summary
Constructors Constructor Description SimpleBufferAllocator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IoBuffer
allocate(int capacity, boolean direct)
Returns the buffer which is capable of the specified size.java.nio.ByteBuffer
allocateNioBuffer(int capacity, boolean direct)
Returns the NIO buffer which is capable of the specified size.void
dispose()
Dispose of this allocator.IoBuffer
wrap(java.nio.ByteBuffer nioBuffer)
Wraps the specified NIOByteBuffer
into MINA buffer.
-
-
-
Method Detail
-
allocate
public IoBuffer allocate(int capacity, boolean direct)
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
public java.nio.ByteBuffer allocateNioBuffer(int capacity, boolean direct)
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
public IoBuffer wrap(java.nio.ByteBuffer nioBuffer)
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
-
-