Interface ChannelBufferFactory
- All Known Implementing Classes:
AbstractChannelBufferFactory, DirectChannelBufferFactory, HeapChannelBufferFactory
public interface ChannelBufferFactory
A factory that creates or pools
ChannelBuffers.-
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.getBuffer(ByteBuffer nioBuffer) Returns aChannelBufferwhose content is equal to the sub-region of the specifiednioBuffer.Returns aChannelBufferwhose content is equal to the sub-region of the specifiedarray.Returns the default endianness of theChannelBufferwhich is returned bygetBuffer(int).
-
Method Details
-
getBuffer
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
- Parameters:
endianness- the endianness of the returnedChannelBuffercapacity- the capacity of the returnedChannelBuffer- Returns:
- a
ChannelBufferwith the specifiedendiannessandcapacity, whosereaderIndexandwriterIndexare0
-
getBuffer
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
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
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
ByteOrder getDefaultOrder()Returns the default endianness of theChannelBufferwhich is returned bygetBuffer(int).- Returns:
- the default endianness of the
ChannelBufferwhich is returned bygetBuffer(int)
-