Package org.jboss.netty.buffer
Interface ChannelBufferFactory
-
- All Known Implementing Classes:
AbstractChannelBufferFactory,DirectChannelBufferFactory,HeapChannelBufferFactory
public interface ChannelBufferFactoryA factory that creates or poolsChannelBuffers.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ChannelBuffergetBuffer(byte[] array, int offset, int length)Returns aChannelBufferwhose content is equal to the sub-region of the specifiedarray.ChannelBuffergetBuffer(int capacity)Returns aChannelBufferwith the specifiedcapacity.ChannelBuffergetBuffer(java.nio.ByteBuffer nioBuffer)Returns aChannelBufferwhose content is equal to the sub-region of the specifiednioBuffer.ChannelBuffergetBuffer(java.nio.ByteOrder endianness, byte[] array, int offset, int length)Returns aChannelBufferwhose content is equal to the sub-region of the specifiedarray.ChannelBuffergetBuffer(java.nio.ByteOrder endianness, int capacity)java.nio.ByteOrdergetDefaultOrder()Returns the default endianness of theChannelBufferwhich is returned bygetBuffer(int).
-
-
-
Method Detail
-
getBuffer
ChannelBuffer getBuffer(int capacity)
Returns aChannelBufferwith the specifiedcapacity. This method is identical togetBuffer(getDefaultOrder(), capacity).- Parameters:
capacity- the capacity of the returnedChannelBuffer- Returns:
- a
ChannelBufferwith the specifiedcapacity, whosereaderIndexandwriterIndexare0
-
getBuffer
ChannelBuffer getBuffer(java.nio.ByteOrder endianness, int capacity)
- Parameters:
endianness- the endianness of the returnedChannelBuffercapacity- the capacity of the returnedChannelBuffer- Returns:
- a
ChannelBufferwith the specifiedendiannessandcapacity, whosereaderIndexandwriterIndexare0
-
getBuffer
ChannelBuffer getBuffer(byte[] array, int offset, int length)
Returns 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).- 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
-
getBuffer
ChannelBuffer getBuffer(java.nio.ByteOrder endianness, byte[] array, int offset, int length)
Returns 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.- Parameters:
endianness- the endianness of the returnedChannelBufferarray- 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
-
getBuffer
ChannelBuffer getBuffer(java.nio.ByteBuffer nioBuffer)
Returns aChannelBufferwhose content is equal to the sub-region of the specifiednioBuffer. Depending on the factory implementation, the returned buffer could wrap thenioBufferor create a new copy of thenioBuffer.- Parameters:
nioBuffer- the NIOByteBuffer- Returns:
- a
ChannelBufferwith the specified content, whosereaderIndexandwriterIndexare0andnioBuffer.remaining()respectively
-
getDefaultOrder
java.nio.ByteOrder getDefaultOrder()
Returns the default endianness of theChannelBufferwhich is returned bygetBuffer(int).- Returns:
- the default endianness of the
ChannelBufferwhich is returned bygetBuffer(int)
-
-