|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.messaging.core.buffers.AbstractChannelBuffer
org.jboss.messaging.core.buffers.ByteBufferBackedChannelBuffer
public class ByteBufferBackedChannelBuffer
A NIO ByteBuffer
based buffer. It is recommended to use ChannelBuffers#directBuffer(int)
and ChannelBuffers.wrappedBuffer(ByteBuffer)
instead of calling the
constructor explicitly.
Method Summary | |
---|---|
byte[] |
array()
|
int |
capacity()
Returns the number of bytes (octets) this buffer can contain. |
byte |
getByte(int index)
Gets a byte at the specified absolute index in this buffer. |
void |
getBytes(int index,
byte[] dst,
int dstIndex,
int length)
Transfers this buffer's data to the specified destination starting at the specified absolute index . |
void |
getBytes(int index,
java.nio.ByteBuffer dst)
Transfers this buffer's data to the specified destination starting at the specified absolute index until the destination's position
reaches its limit. |
void |
getBytes(int index,
ChannelBuffer dst,
int dstIndex,
int length)
Transfers this buffer's data to the specified destination starting at the specified absolute index . |
int |
getBytes(int index,
java.nio.channels.GatheringByteChannel out,
int length)
Transfers this buffer's data to the specified channel starting at the specified absolute index . |
void |
getBytes(int index,
java.io.OutputStream out,
int length)
Transfers this buffer's data to the specified stream starting at the specified absolute index . |
int |
getInt(int index)
Gets a 32-bit integer at the specified absolute index in
this buffer. |
long |
getLong(int index)
Gets a 64-bit long integer at the specified absolute index in
this buffer. |
short |
getShort(int index)
Gets a 16-bit short integer at the specified absolute index in
this buffer. |
int |
getUnsignedMedium(int index)
Gets an unsigned 24-bit medium integer at the specified absolute index in this buffer. |
void |
setByte(int index,
byte value)
Sets the specified byte at the specified absolute index in this
buffer. |
void |
setBytes(int index,
byte[] src,
int srcIndex,
int length)
Transfers the specified source array's data to this buffer starting at the specified absolute index . |
void |
setBytes(int index,
java.nio.ByteBuffer src)
Transfers the specified source buffer's data to this buffer starting at the specified absolute index until the source buffer's position
reaches its limit. |
void |
setBytes(int index,
ChannelBuffer src,
int srcIndex,
int length)
Transfers the specified source buffer's data to this buffer starting at the specified absolute index . |
int |
setBytes(int index,
java.io.InputStream in,
int length)
Transfers the content of the specified source stream to this buffer starting at the specified absolute index . |
int |
setBytes(int index,
java.nio.channels.ScatteringByteChannel in,
int length)
Transfers the content of the specified source channel to this buffer starting at the specified absolute index . |
void |
setInt(int index,
int value)
Sets the specified 32-bit integer at the specified absolute index in this buffer. |
void |
setLong(int index,
long value)
Sets the specified 64-bit long integer at the specified absolute index in this buffer. |
void |
setMedium(int index,
int value)
Sets the specified 24-bit medium integer at the specified absolute index in this buffer. |
void |
setShort(int index,
short value)
Sets the specified 16-bit short integer at the specified absolute index in this buffer. |
java.nio.ByteBuffer |
toByteBuffer()
Converts this buffer's readable bytes into a NIO buffer. |
java.nio.ByteBuffer |
toByteBuffer(int index,
int length)
Converts this buffer's sub-region into a NIO buffer. |
java.lang.String |
toString(int index,
int length,
java.lang.String charsetName)
Decodes this buffer's sub-region into a string with the specified character set name. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public int capacity()
ChannelBuffer
public byte getByte(int index)
ChannelBuffer
index
in this buffer.
public short getShort(int index)
ChannelBuffer
index
in
this buffer.
public int getUnsignedMedium(int index)
ChannelBuffer
index
in this buffer.
public int getInt(int index)
ChannelBuffer
index
in
this buffer.
public long getLong(int index)
ChannelBuffer
index
in
this buffer.
public void getBytes(int index, ChannelBuffer dst, int dstIndex, int length)
ChannelBuffer
index
.
dstIndex
- the first index of the destinationlength
- the number of bytes to transferpublic void getBytes(int index, byte[] dst, int dstIndex, int length)
ChannelBuffer
index
.
dstIndex
- the first index of the destinationlength
- the number of bytes to transferpublic void getBytes(int index, java.nio.ByteBuffer dst)
ChannelBuffer
index
until the destination's position
reaches its limit.
public void setByte(int index, byte value)
ChannelBuffer
index
in this
buffer.
public void setShort(int index, short value)
ChannelBuffer
index
in this buffer.
public void setMedium(int index, int value)
ChannelBuffer
index
in this buffer. Please note that the most significant
byte is ignored in the specified value.
public void setInt(int index, int value)
ChannelBuffer
index
in this buffer.
public void setLong(int index, long value)
ChannelBuffer
index
in this buffer.
public void setBytes(int index, ChannelBuffer src, int srcIndex, int length)
ChannelBuffer
index
.
srcIndex
- the first index of the sourcelength
- the number of bytes to transferpublic void setBytes(int index, byte[] src, int srcIndex, int length)
ChannelBuffer
index
.
public void setBytes(int index, java.nio.ByteBuffer src)
ChannelBuffer
index
until the source buffer's position
reaches its limit.
public void getBytes(int index, java.io.OutputStream out, int length) throws java.io.IOException
ChannelBuffer
index
.
length
- the number of bytes to transfer
java.io.IOException
- if the specified stream threw an exception during I/Opublic int getBytes(int index, java.nio.channels.GatheringByteChannel out, int length) throws java.io.IOException
ChannelBuffer
index
.
length
- the maximum number of bytes to transfer
java.io.IOException
- if the specified channel threw an exception during I/Opublic int setBytes(int index, java.io.InputStream in, int length) throws java.io.IOException
ChannelBuffer
index
.
length
- the number of bytes to transfer
-1
if the specified channel is closed.
java.io.IOException
- if the specified stream threw an exception during I/Opublic int setBytes(int index, java.nio.channels.ScatteringByteChannel in, int length) throws java.io.IOException
ChannelBuffer
index
.
length
- the maximum number of bytes to transfer
-1
if the specified channel is closed.
java.io.IOException
- if the specified channel threw an exception during I/Opublic java.nio.ByteBuffer toByteBuffer(int index, int length)
ChannelBuffer
public java.nio.ByteBuffer toByteBuffer()
ChannelBuffer
buf.toByteBuffer(buf.readerIndex(), buf.readableBytes())
.
toByteBuffer
in interface ChannelBuffer
toByteBuffer
in class AbstractChannelBuffer
public java.lang.String toString(int index, int length, java.lang.String charsetName)
ChannelBuffer
public byte[] array()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |