|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.netty.buffer.AbstractChannelBufferFactory
org.jboss.netty.buffer.HeapChannelBufferFactory
public class HeapChannelBufferFactory
A ChannelBufferFactory
which merely allocates a heap buffer with
the specified capacity. HeapChannelBufferFactory
should perform
very well in most situations because it relies on the JVM garbage collector,
which is highly optimized for heap allocation.
Constructor Summary | |
---|---|
HeapChannelBufferFactory()
Creates a new factory whose default ByteOrder is
ByteOrder.BIG_ENDIAN . |
|
HeapChannelBufferFactory(ByteOrder defaultOrder)
Creates a new factory with the specified default ByteOrder . |
Method Summary | |
---|---|
ChannelBuffer |
getBuffer(ByteBuffer nioBuffer)
Returns a ChannelBuffer whose content is equal to the sub-region
of the specified nioBuffer . |
ChannelBuffer |
getBuffer(ByteOrder order,
byte[] array,
int offset,
int length)
Returns a ChannelBuffer whose content is equal to the sub-region
of the specified array . |
ChannelBuffer |
getBuffer(ByteOrder order,
int capacity)
Returns a ChannelBuffer with the specified endianness
and capacity . |
static ChannelBufferFactory |
getInstance()
|
static ChannelBufferFactory |
getInstance(ByteOrder endianness)
|
Methods inherited from class org.jboss.netty.buffer.AbstractChannelBufferFactory |
---|
getBuffer, getBuffer, getDefaultOrder |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HeapChannelBufferFactory()
ByteOrder
is
ByteOrder.BIG_ENDIAN
.
public HeapChannelBufferFactory(ByteOrder defaultOrder)
ByteOrder
.
defaultOrder
- the default ByteOrder
of this factoryMethod Detail |
---|
public static ChannelBufferFactory getInstance()
public static ChannelBufferFactory getInstance(ByteOrder endianness)
public ChannelBuffer getBuffer(ByteOrder order, int capacity)
ChannelBufferFactory
ChannelBuffer
with the specified endianness
and capacity
.
order
- the endianness of the returned ChannelBuffer
capacity
- the capacity of the returned ChannelBuffer
ChannelBuffer
with the specified endianness
and
capacity
, whose readerIndex
and writerIndex
are 0
public ChannelBuffer getBuffer(ByteOrder order, byte[] array, int offset, int length)
ChannelBufferFactory
ChannelBuffer
whose content is equal to the sub-region
of the specified array
. Depending on the factory implementation,
the returned buffer could wrap the array
or create a new copy of
the array
.
order
- the endianness of the returned ChannelBuffer
array
- the byte arrayoffset
- the offset of the byte arraylength
- the length of the byte array
ChannelBuffer
with the specified content,
whose readerIndex
and writerIndex
are 0
and (length - offset)
respectivelypublic ChannelBuffer getBuffer(ByteBuffer nioBuffer)
ChannelBufferFactory
ChannelBuffer
whose content is equal to the sub-region
of the specified nioBuffer
. Depending on the factory
implementation, the returned buffer could wrap the nioBuffer
or
create a new copy of the nioBuffer
.
nioBuffer
- the NIO ByteBuffer
ChannelBuffer
with the specified content,
whose readerIndex
and writerIndex
are 0
and nioBuffer.remaining()
respectively
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |