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
ConstructorsModifierConstructorDescriptionprotectedCreates a new factory whose defaultByteOrderisByteOrder.BIG_ENDIAN.protectedAbstractChannelBufferFactory(ByteOrder defaultOrder) Creates a new factory with the specified defaultByteOrder. -
Method Summary
Modifier and TypeMethodDescriptiongetBuffer(byte[] array, int offset, int length) Returns aChannelBufferwhose content is equal to the sub-region of the specifiedarray.getBuffer(int capacity) Returns aChannelBufferwith the specifiedcapacity.Returns the default endianness of theChannelBufferwhich is returned byChannelBufferFactory.getBuffer(int).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jboss.netty.buffer.ChannelBufferFactory
getBuffer, getBuffer, getBuffer
-
Field Details
-
defaultOrder
-
-
Constructor Details
-
AbstractChannelBufferFactory
protected AbstractChannelBufferFactory()Creates a new factory whose defaultByteOrderisByteOrder.BIG_ENDIAN. -
AbstractChannelBufferFactory
Creates a new factory with the specified defaultByteOrder.- Parameters:
defaultOrder- the defaultByteOrderof this factory
-
-
Method Details
-
getBuffer
Description copied from interface:ChannelBufferFactoryReturns aChannelBufferwith the specifiedcapacity. This method is identical togetBuffer(getDefaultOrder(), capacity).- Specified by:
getBufferin interfaceChannelBufferFactory- Parameters:
capacity- the capacity of the returnedChannelBuffer- Returns:
- a
ChannelBufferwith the specifiedcapacity, whosereaderIndexandwriterIndexare0
-
getBuffer
Description copied from interface:ChannelBufferFactoryReturns aChannelBufferwhose content is equal to the sub-region of the specifiedarray. Depending on the factory implementation, the returned buffer could wrap thearrayor create a new copy of thearray. This method is identical togetBuffer(getDefaultOrder(), array, offset, length).- Specified by:
getBufferin interfaceChannelBufferFactory- Parameters:
array- the byte arrayoffset- the offset of the byte arraylength- the length of the byte array- Returns:
- a
ChannelBufferwith the specified content, whosereaderIndexandwriterIndexare0and(length - offset)respectively
-
getDefaultOrder
Description copied from interface:ChannelBufferFactoryReturns the default endianness of theChannelBufferwhich is returned byChannelBufferFactory.getBuffer(int).- Specified by:
getDefaultOrderin interfaceChannelBufferFactory- Returns:
- the default endianness of the
ChannelBufferwhich is returned byChannelBufferFactory.getBuffer(int)
-