Package org.jboss.netty.buffer
Class AbstractChannelBufferFactory
java.lang.Object
org.jboss.netty.buffer.AbstractChannelBufferFactory
- All Implemented Interfaces:
ChannelBufferFactory
- Direct Known Subclasses:
DirectChannelBufferFactory
,HeapChannelBufferFactory
A skeletal implementation of
ChannelBufferFactory
.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Creates a new factory whose defaultByteOrder
isByteOrder.BIG_ENDIAN
.protected
AbstractChannelBufferFactory
(ByteOrder defaultOrder) Creates a new factory with the specified defaultByteOrder
. -
Method Summary
Modifier and TypeMethodDescriptiongetBuffer
(byte[] array, int offset, int length) Returns aChannelBuffer
whose content is equal to the sub-region of the specifiedarray
.getBuffer
(int capacity) Returns aChannelBuffer
with the specifiedcapacity
.Returns the default endianness of theChannelBuffer
which is returned byChannelBufferFactory.getBuffer(int)
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jboss.netty.buffer.ChannelBufferFactory
getBuffer, getBuffer, getBuffer
-
Field Details
-
defaultOrder
-
-
Constructor Details
-
AbstractChannelBufferFactory
protected AbstractChannelBufferFactory()Creates a new factory whose defaultByteOrder
isByteOrder.BIG_ENDIAN
. -
AbstractChannelBufferFactory
Creates a new factory with the specified defaultByteOrder
.- Parameters:
defaultOrder
- the defaultByteOrder
of this factory
-
-
Method Details
-
getBuffer
Description copied from interface:ChannelBufferFactory
Returns aChannelBuffer
with the specifiedcapacity
. This method is identical togetBuffer(getDefaultOrder(), capacity)
.- Specified by:
getBuffer
in interfaceChannelBufferFactory
- Parameters:
capacity
- the capacity of the returnedChannelBuffer
- Returns:
- a
ChannelBuffer
with the specifiedcapacity
, whosereaderIndex
andwriterIndex
are0
-
getBuffer
Description copied from interface:ChannelBufferFactory
Returns aChannelBuffer
whose content is equal to the sub-region of the specifiedarray
. Depending on the factory implementation, the returned buffer could wrap thearray
or create a new copy of thearray
. This method is identical togetBuffer(getDefaultOrder(), array, offset, length)
.- Specified by:
getBuffer
in interfaceChannelBufferFactory
- Parameters:
array
- the byte arrayoffset
- the offset of the byte arraylength
- the length of the byte array- Returns:
- a
ChannelBuffer
with the specified content, whosereaderIndex
andwriterIndex
are0
and(length - offset)
respectively
-
getDefaultOrder
Description copied from interface:ChannelBufferFactory
Returns the default endianness of theChannelBuffer
which is returned byChannelBufferFactory.getBuffer(int)
.- Specified by:
getDefaultOrder
in interfaceChannelBufferFactory
- Returns:
- the default endianness of the
ChannelBuffer
which is returned byChannelBufferFactory.getBuffer(int)
-