public abstract class AbstractByteBufFactory extends Object implements ByteBufFactory
ByteBufFactory
.Modifier | Constructor and Description |
---|---|
protected |
AbstractByteBufFactory()
Creates a new factory whose default
ByteOrder is
ByteOrder.BIG_ENDIAN . |
protected |
AbstractByteBufFactory(ByteOrder defaultOrder)
Creates a new factory with the specified default
ByteOrder . |
Modifier and Type | Method and Description |
---|---|
ByteBuf |
getBuffer(byte[] array,
int offset,
int length)
Returns a
ByteBuf whose content is equal to the sub-region
of the specified array . |
ByteBuf |
getBuffer(int capacity)
Returns a
ByteBuf with the specified capacity . |
ByteOrder |
getDefaultOrder()
Returns the default endianness of the
ByteBuf which is
returned by ByteBufFactory.getBuffer(int) . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBuffer, getBuffer, getBuffer
protected AbstractByteBufFactory()
ByteOrder
is
ByteOrder.BIG_ENDIAN
.public ByteBuf getBuffer(int capacity)
ByteBufFactory
ByteBuf
with the specified capacity
.
This method is identical to getBuffer(getDefaultOrder(), capacity)
.getBuffer
in interface ByteBufFactory
capacity
- the capacity of the returned ByteBuf
ByteBuf
with the specified capacity
,
whose readerIndex
and writerIndex
are 0
public ByteBuf getBuffer(byte[] array, int offset, int length)
ByteBufFactory
ByteBuf
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
.
This method is identical to getBuffer(getDefaultOrder(), array, offset, length)
.getBuffer
in interface ByteBufFactory
array
- the byte arrayoffset
- the offset of the byte arraylength
- the length of the byte arrayByteBuf
with the specified content,
whose readerIndex
and writerIndex
are 0
and (length - offset)
respectivelypublic ByteOrder getDefaultOrder()
ByteBufFactory
ByteBuf
which is
returned by ByteBufFactory.getBuffer(int)
.getDefaultOrder
in interface ByteBufFactory
ByteBuf
which is
returned by ByteBufFactory.getBuffer(int)
Copyright © 2008-2012 The Netty Project. All Rights Reserved.