Package org.jboss.netty.buffer
Interface ChannelBufferFactory
-
- All Known Implementing Classes:
AbstractChannelBufferFactory
,DirectChannelBufferFactory
,HeapChannelBufferFactory
public interface ChannelBufferFactory
A factory that creates or poolsChannelBuffer
s.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ChannelBuffer
getBuffer(byte[] array, int offset, int length)
Returns aChannelBuffer
whose content is equal to the sub-region of the specifiedarray
.ChannelBuffer
getBuffer(int capacity)
Returns aChannelBuffer
with the specifiedcapacity
.ChannelBuffer
getBuffer(java.nio.ByteBuffer nioBuffer)
Returns aChannelBuffer
whose content is equal to the sub-region of the specifiednioBuffer
.ChannelBuffer
getBuffer(java.nio.ByteOrder endianness, byte[] array, int offset, int length)
Returns aChannelBuffer
whose content is equal to the sub-region of the specifiedarray
.ChannelBuffer
getBuffer(java.nio.ByteOrder endianness, int capacity)
java.nio.ByteOrder
getDefaultOrder()
Returns the default endianness of theChannelBuffer
which is returned bygetBuffer(int)
.
-
-
-
Method Detail
-
getBuffer
ChannelBuffer getBuffer(int capacity)
Returns aChannelBuffer
with the specifiedcapacity
. This method is identical togetBuffer(getDefaultOrder(), capacity)
.- Parameters:
capacity
- the capacity of the returnedChannelBuffer
- Returns:
- a
ChannelBuffer
with the specifiedcapacity
, whosereaderIndex
andwriterIndex
are0
-
getBuffer
ChannelBuffer getBuffer(java.nio.ByteOrder endianness, int capacity)
- Parameters:
endianness
- the endianness of the returnedChannelBuffer
capacity
- the capacity of the returnedChannelBuffer
- Returns:
- a
ChannelBuffer
with the specifiedendianness
andcapacity
, whosereaderIndex
andwriterIndex
are0
-
getBuffer
ChannelBuffer getBuffer(byte[] array, int offset, int length)
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)
.- 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
-
getBuffer
ChannelBuffer getBuffer(java.nio.ByteOrder endianness, byte[] array, int offset, int length)
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
.- Parameters:
endianness
- the endianness of the returnedChannelBuffer
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
-
getBuffer
ChannelBuffer getBuffer(java.nio.ByteBuffer nioBuffer)
Returns aChannelBuffer
whose content is equal to the sub-region of the specifiednioBuffer
. Depending on the factory implementation, the returned buffer could wrap thenioBuffer
or create a new copy of thenioBuffer
.- Parameters:
nioBuffer
- the NIOByteBuffer
- Returns:
- a
ChannelBuffer
with the specified content, whosereaderIndex
andwriterIndex
are0
andnioBuffer.remaining()
respectively
-
getDefaultOrder
java.nio.ByteOrder getDefaultOrder()
Returns the default endianness of theChannelBuffer
which is returned bygetBuffer(int)
.- Returns:
- the default endianness of the
ChannelBuffer
which is returned bygetBuffer(int)
-
-