|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.messaging.core.buffers.AbstractChannelBuffer
public abstract class AbstractChannelBuffer
A skeletal implementation of a buffer.
Constructor Summary | |
---|---|
AbstractChannelBuffer()
|
Method Summary | |
---|---|
protected void |
checkReadableBytes(int minimumReadableBytes)
Throws an IndexOutOfBoundsException if the current
readable bytes of this buffer is less
than the specified value. |
void |
clear()
Sets the readerIndex and writerIndex of this buffer to
0 . |
int |
compareTo(ChannelBuffer that)
Compares the content of the specified buffer to the content of this buffer. |
void |
discardReadBytes()
Discards the bytes between the 0th index and readerIndex . |
boolean |
equals(java.lang.Object o)
Determines if the content of the specified buffer is identical to the content of this array. |
void |
getBytes(int index,
byte[] dst)
Transfers this buffer's data to the specified destination starting at the specified absolute index . |
void |
getBytes(int index,
ChannelBuffer dst)
Transfers this buffer's data to the specified destination starting at the specified absolute index until the destination becomes
non-writable. |
void |
getBytes(int index,
ChannelBuffer dst,
int length)
Transfers this buffer's data to the specified destination starting at the specified absolute index . |
int |
getMedium(int index)
Gets a 24-bit medium integer at the specified absolute index in
this buffer. |
java.lang.Object |
getUnderlyingBuffer()
|
short |
getUnsignedByte(int index)
Gets an unsigned byte at the specified absolute index in this
buffer. |
long |
getUnsignedInt(int index)
Gets an unsigned 32-bit integer at the specified absolute index
in this buffer. |
int |
getUnsignedShort(int index)
Gets an unsigned 16-bit short integer at the specified absolute index in this buffer. |
int |
hashCode()
Returns a hash code which was calculated from the content of this buffer. |
void |
markReaderIndex()
Marks the current readerIndex in this buffer. |
void |
markWriterIndex()
Marks the current writerIndex in this buffer. |
boolean |
readable()
Returns true
if and only if (this.writerIndex - this.readerIndex) is greater
than 0 . |
int |
readableBytes()
Returns the number of readable bytes which is equal to (this.writerIndex - this.readerIndex) . |
boolean |
readBoolean()
|
byte |
readByte()
Gets a byte at the current readerIndex and increases
the readerIndex by 1 in this buffer. |
void |
readBytes(byte[] dst)
Transfers this buffer's data to the specified destination starting at the current readerIndex and increases the readerIndex
by the number of the transferred bytes (= dst.length ). |
void |
readBytes(byte[] dst,
int dstIndex,
int length)
Transfers this buffer's data to the specified destination starting at the current readerIndex and increases the readerIndex
by the number of the transferred bytes (= length ). |
void |
readBytes(java.nio.ByteBuffer dst)
Transfers this buffer's data to the specified destination starting at the current readerIndex until the destination's position
reaches its limit, and increases the readerIndex by the
number of the transferred bytes. |
void |
readBytes(ChannelBuffer dst)
Transfers this buffer's data to the specified destination starting at the current readerIndex until the destination becomes
non-writable, and increases the readerIndex by the number of the
transferred bytes. |
void |
readBytes(ChannelBuffer dst,
int length)
Transfers this buffer's data to the specified destination starting at the current readerIndex and increases the readerIndex
by the number of the transferred bytes (= length ). |
void |
readBytes(ChannelBuffer dst,
int dstIndex,
int length)
Transfers this buffer's data to the specified destination starting at the current readerIndex and increases the readerIndex
by the number of the transferred bytes (= length ). |
int |
readBytes(java.nio.channels.GatheringByteChannel out,
int length)
Transfers this buffer's data to the specified stream starting at the current readerIndex . |
void |
readBytes(java.io.OutputStream out,
int length)
Transfers this buffer's data to the specified stream starting at the current readerIndex . |
char |
readChar()
|
double |
readDouble()
|
int |
readerIndex()
Returns the readerIndex of this buffer. |
void |
readerIndex(int readerIndex)
Sets the readerIndex of this buffer. |
float |
readFloat()
|
int |
readInt()
Gets a 32-bit integer at the current readerIndex
and increases the readerIndex by 4 in this buffer. |
long |
readLong()
Gets a 64-bit integer at the current readerIndex
and increases the readerIndex by 8 in this buffer. |
int |
readMedium()
Gets a 24-bit medium integer at the current readerIndex
and increases the readerIndex by 3 in this buffer. |
SimpleString |
readNullableSimpleString()
|
java.lang.String |
readNullableString()
|
short |
readShort()
Gets a 16-bit short integer at the current readerIndex
and increases the readerIndex by 2 in this buffer. |
SimpleString |
readSimpleString()
|
java.lang.String |
readString()
|
short |
readUnsignedByte()
Gets an unsigned byte at the current readerIndex and increases
the readerIndex by 1 in this buffer. |
long |
readUnsignedInt()
Gets an unsigned 32-bit integer at the current readerIndex
and increases the readerIndex by 4 in this buffer. |
int |
readUnsignedMedium()
Gets an unsigned 24-bit medium integer at the current readerIndex
and increases the readerIndex by 3 in this buffer. |
int |
readUnsignedShort()
Gets an unsigned 16-bit short integer at the current readerIndex
and increases the readerIndex by 2 in this buffer. |
java.lang.String |
readUTF()
|
void |
resetReaderIndex()
Repositions the current readerIndex to the marked
readerIndex in this buffer. |
void |
resetWriterIndex()
Repositions the current writerIndex to the marked
writerIndex in this buffer. |
void |
setBytes(int index,
byte[] src)
Transfers the specified source array's data to this buffer starting at the specified absolute index . |
void |
setBytes(int index,
ChannelBuffer src)
Transfers the specified source buffer's data to this buffer starting at the specified absolute index until the destination becomes
unreadable. |
void |
setBytes(int index,
ChannelBuffer src,
int length)
Transfers the specified source buffer's data to this buffer starting at the specified absolute index . |
void |
setIndex(int readerIndex,
int writerIndex)
Sets the readerIndex and writerIndex of this buffer
in one shot. |
void |
setZero(int index,
int length)
Fills this buffer with NUL (0x00) starting at the specified absolute index . |
void |
skipBytes(int length)
Increases the current readerIndex by the specified
length in this buffer. |
java.nio.ByteBuffer |
toByteBuffer()
Converts this buffer's readable bytes into a NIO buffer. |
java.nio.ByteBuffer[] |
toByteBuffers()
|
java.nio.ByteBuffer[] |
toByteBuffers(int index,
int length)
Converts this buffer's sub-region into an array of NIO buffers. |
java.lang.String |
toString()
Returns the string representation of this buffer. |
java.lang.String |
toString(java.lang.String charsetName)
Decodes this buffer's readable bytes into a string with the specified character set name. |
boolean |
writable()
Returns true
if and only if (this.capacity - this.writerIndex) is greater
than 0 . |
int |
writableBytes()
Returns the number of writable bytes which is equal to (this.capacity - this.writerIndex) . |
void |
writeBoolean(boolean val)
|
void |
writeByte(byte value)
Sets the specified byte at the current writerIndex
and increases the writerIndex by 1 in this buffer. |
void |
writeBytes(byte[] src)
Transfers the specified source array's data to this buffer starting at the current writerIndex and increases the writerIndex
by the number of the transferred bytes (= src.length ). |
void |
writeBytes(byte[] src,
int srcIndex,
int length)
Transfers the specified source array's data to this buffer starting at the current writerIndex and increases the writerIndex
by the number of the transferred bytes (= length ). |
void |
writeBytes(java.nio.ByteBuffer src)
Transfers the specified source buffer's data to this buffer starting at the current writerIndex until the source buffer's position
reaches its limit, and increases the writerIndex by the
number of the transferred bytes. |
void |
writeBytes(ChannelBuffer src)
Transfers the specified source buffer's data to this buffer starting at the current writerIndex until the source buffer becomes
unreadable, and increases the writerIndex by the number of
the transferred bytes. |
void |
writeBytes(ChannelBuffer src,
int length)
Transfers the specified source buffer's data to this buffer starting at the current writerIndex and increases the writerIndex
by the number of the transferred bytes (= length ). |
void |
writeBytes(ChannelBuffer src,
int srcIndex,
int length)
Transfers the specified source buffer's data to this buffer starting at the current writerIndex and increases the writerIndex
by the number of the transferred bytes (= length ). |
void |
writeBytes(java.io.InputStream in,
int length)
Transfers the content of the specified stream to this buffer starting at the current writerIndex and increases the
writerIndex by the number of the transferred bytes. |
void |
writeBytes(MessagingBuffer src,
int srcIndex,
int length)
|
int |
writeBytes(java.nio.channels.ScatteringByteChannel in,
int length)
Transfers the content of the specified channel to this buffer starting at the current writerIndex and increases the
writerIndex by the number of the transferred bytes. |
void |
writeChar(char val)
|
void |
writeDouble(double val)
|
void |
writeFloat(float val)
|
void |
writeInt(int value)
Sets the specified 32-bit integer at the current writerIndex
and increases the writerIndex by 4 in this buffer. |
void |
writeLong(long value)
Sets the specified 64-bit long integer at the current writerIndex and increases the writerIndex by 8
in this buffer. |
void |
writeMedium(int value)
Sets the specified 24-bit medium integer at the current writerIndex and increases the writerIndex by 3
in this buffer. |
void |
writeNullableSimpleString(SimpleString val)
|
void |
writeNullableString(java.lang.String val)
|
int |
writerIndex()
Returns the writerIndex of this buffer. |
void |
writerIndex(int writerIndex)
Sets the writerIndex of this buffer. |
void |
writeShort(short value)
Sets the specified 16-bit short integer at the current writerIndex and increases the writerIndex by 2
in this buffer. |
void |
writeSimpleString(SimpleString val)
|
void |
writeString(java.lang.String val)
|
void |
writeUTF(java.lang.String utf)
|
void |
writeZero(int length)
Fills this buffer with NUL (0x00) starting at the current writerIndex and increases the writerIndex by the
specified length . |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.jboss.messaging.core.buffers.ChannelBuffer |
---|
array, capacity, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getInt, getLong, getShort, getUnsignedMedium, setByte, setBytes, setBytes, setBytes, setBytes, setBytes, setInt, setLong, setMedium, setShort, toByteBuffer, toString |
Constructor Detail |
---|
public AbstractChannelBuffer()
Method Detail |
---|
public int readerIndex()
ChannelBuffer
readerIndex
of this buffer.
readerIndex
in interface ChannelBuffer
readerIndex
in interface MessagingBuffer
public void readerIndex(int readerIndex)
ChannelBuffer
readerIndex
of this buffer.
readerIndex
in interface ChannelBuffer
readerIndex
in interface MessagingBuffer
public int writerIndex()
ChannelBuffer
writerIndex
of this buffer.
writerIndex
in interface ChannelBuffer
writerIndex
in interface MessagingBuffer
public void writerIndex(int writerIndex)
ChannelBuffer
writerIndex
of this buffer.
writerIndex
in interface ChannelBuffer
writerIndex
in interface MessagingBuffer
public void setIndex(int readerIndex, int writerIndex)
ChannelBuffer
readerIndex
and writerIndex
of this buffer
in one shot. This method is useful when you have to worry about the
invocation order of ChannelBuffer.readerIndex(int)
and ChannelBuffer.writerIndex(int)
methods. For example, the following code will fail:
// Create a buffer whose readerIndex, writerIndex and capacity are // 0, 0 and 8 respectively. ChannelBuffer buf = ChannelBuffers.buffer(8); // IndexOutOfBoundsException is thrown because the specified // readerIndex (2) cannot be greater than the current writerIndex (0). buf.readerIndex(2); buf.writerIndex(4);The following code will also fail:
// Create a buffer whose readerIndex, writerIndex and capacity are // 0, 8 and 8 respectively. ChannelBuffer buf = ChannelBuffers.wrappedBuffer(new byte[8]); // readerIndex becomes 8. buf.readLong(); // IndexOutOfBoundsException is thrown because the specified // writerIndex (4) cannot be less than the current readerIndex (8). buf.writerIndex(4); buf.readerIndex(2);By contrast,
ChannelBuffer.setIndex(int, int)
guarantees that it never
throws an IndexOutOfBoundsException
as long as the specified
indexes meet basic constraints, regardless what the current index
values of the buffer are:
// No matter what the current state of the buffer is, the following // call always succeeds as long as the capacity of the buffer is not // less than 4. buf.setIndex(2, 4);
setIndex
in interface ChannelBuffer
setIndex
in interface MessagingBuffer
public void clear()
ChannelBuffer
readerIndex
and writerIndex
of this buffer to
0
.
This method is identical to setIndex(0, 0)
.
Please note that the behavior of this method is different
from that of NIO buffer, which sets the limit
to
the capacity
of the buffer.
clear
in interface ChannelBuffer
clear
in interface MessagingBuffer
public boolean readable()
ChannelBuffer
true
if and only if (this.writerIndex - this.readerIndex)
is greater
than 0
.
readable
in interface ChannelBuffer
readable
in interface MessagingBuffer
public boolean writable()
ChannelBuffer
true
if and only if (this.capacity - this.writerIndex)
is greater
than 0
.
writable
in interface ChannelBuffer
writable
in interface MessagingBuffer
public int readableBytes()
ChannelBuffer
(this.writerIndex - this.readerIndex)
.
readableBytes
in interface ChannelBuffer
readableBytes
in interface MessagingBuffer
public int writableBytes()
ChannelBuffer
(this.capacity - this.writerIndex)
.
writableBytes
in interface ChannelBuffer
writableBytes
in interface MessagingBuffer
public void markReaderIndex()
ChannelBuffer
readerIndex
in this buffer. You can
reposition the current readerIndex
to the marked
readerIndex
by calling ChannelBuffer.resetReaderIndex()
.
The initial value of the marked readerIndex
is 0
.
markReaderIndex
in interface ChannelBuffer
public void resetReaderIndex()
ChannelBuffer
readerIndex
to the marked
readerIndex
in this buffer.
resetReaderIndex
in interface ChannelBuffer
resetReaderIndex
in interface MessagingBuffer
public void markWriterIndex()
ChannelBuffer
writerIndex
in this buffer. You can
reposition the current writerIndex
to the marked
writerIndex
by calling ChannelBuffer.resetWriterIndex()
.
The initial value of the marked writerIndex
is 0
.
markWriterIndex
in interface ChannelBuffer
public void resetWriterIndex()
ChannelBuffer
writerIndex
to the marked
writerIndex
in this buffer.
resetWriterIndex
in interface ChannelBuffer
resetWriterIndex
in interface MessagingBuffer
public void discardReadBytes()
ChannelBuffer
readerIndex
.
It moves the bytes between readerIndex
and writerIndex
to the 0th index, and sets readerIndex
and writerIndex
to 0
and oldWriterIndex - oldReaderIndex
respectively.
Please refer to the class documentation for more detailed explanation.
discardReadBytes
in interface ChannelBuffer
public short getUnsignedByte(int index)
ChannelBuffer
index
in this
buffer.
getUnsignedByte
in interface ChannelBuffer
public int getUnsignedShort(int index)
ChannelBuffer
index
in this buffer.
getUnsignedShort
in interface ChannelBuffer
public int getMedium(int index)
ChannelBuffer
index
in
this buffer.
getMedium
in interface ChannelBuffer
public long getUnsignedInt(int index)
ChannelBuffer
index
in this buffer.
getUnsignedInt
in interface ChannelBuffer
public void getBytes(int index, byte[] dst)
ChannelBuffer
index
.
getBytes
in interface ChannelBuffer
public void getBytes(int index, ChannelBuffer dst)
ChannelBuffer
index
until the destination becomes
non-writable. This method is basically same with
ChannelBuffer.getBytes(int, ChannelBuffer, int, int)
, except that this
method increases the writerIndex
of the destination by the
number of the transferred bytes while
ChannelBuffer.getBytes(int, ChannelBuffer, int, int)
does not.
getBytes
in interface ChannelBuffer
public void getBytes(int index, ChannelBuffer dst, int length)
ChannelBuffer
index
. This method is basically same
with ChannelBuffer.getBytes(int, ChannelBuffer, int, int)
, except that this
method increases the writerIndex
of the destination by the
number of the transferred bytes while
ChannelBuffer.getBytes(int, ChannelBuffer, int, int)
does not.
getBytes
in interface ChannelBuffer
length
- the number of bytes to transferpublic void setBytes(int index, byte[] src)
ChannelBuffer
index
.
setBytes
in interface ChannelBuffer
public void setBytes(int index, ChannelBuffer src)
ChannelBuffer
index
until the destination becomes
unreadable. This method is basically same with
ChannelBuffer.setBytes(int, ChannelBuffer, int, int)
, except that this
method increases the readerIndex
of the source buffer by
the number of the transferred bytes while
ChannelBuffer.getBytes(int, ChannelBuffer, int, int)
does not.
setBytes
in interface ChannelBuffer
public void setBytes(int index, ChannelBuffer src, int length)
ChannelBuffer
index
. This method is basically same
with ChannelBuffer.setBytes(int, ChannelBuffer, int, int)
, except that this
method increases the readerIndex
of the source buffer by
the number of the transferred bytes while
ChannelBuffer.getBytes(int, ChannelBuffer, int, int)
does not.
setBytes
in interface ChannelBuffer
length
- the number of bytes to transferpublic void setZero(int index, int length)
ChannelBuffer
index
.
setZero
in interface ChannelBuffer
length
- the number of NULs to write to the bufferpublic byte readByte()
ChannelBuffer
readerIndex
and increases
the readerIndex
by 1
in this buffer.
readByte
in interface ChannelBuffer
readByte
in interface MessagingBuffer
public short readUnsignedByte()
ChannelBuffer
readerIndex
and increases
the readerIndex
by 1
in this buffer.
readUnsignedByte
in interface ChannelBuffer
readUnsignedByte
in interface MessagingBuffer
public short readShort()
ChannelBuffer
readerIndex
and increases the readerIndex
by 2
in this buffer.
readShort
in interface ChannelBuffer
readShort
in interface MessagingBuffer
public int readUnsignedShort()
ChannelBuffer
readerIndex
and increases the readerIndex
by 2
in this buffer.
readUnsignedShort
in interface ChannelBuffer
readUnsignedShort
in interface MessagingBuffer
public int readMedium()
ChannelBuffer
readerIndex
and increases the readerIndex
by 3
in this buffer.
readMedium
in interface ChannelBuffer
public int readUnsignedMedium()
ChannelBuffer
readerIndex
and increases the readerIndex
by 3
in this buffer.
readUnsignedMedium
in interface ChannelBuffer
public int readInt()
ChannelBuffer
readerIndex
and increases the readerIndex
by 4
in this buffer.
readInt
in interface ChannelBuffer
readInt
in interface MessagingBuffer
public long readUnsignedInt()
ChannelBuffer
readerIndex
and increases the readerIndex
by 4
in this buffer.
readUnsignedInt
in interface ChannelBuffer
public long readLong()
ChannelBuffer
readerIndex
and increases the readerIndex
by 8
in this buffer.
readLong
in interface ChannelBuffer
readLong
in interface MessagingBuffer
public void readBytes(byte[] dst, int dstIndex, int length)
ChannelBuffer
readerIndex
and increases the readerIndex
by the number of the transferred bytes (= length
).
readBytes
in interface ChannelBuffer
readBytes
in interface MessagingBuffer
dstIndex
- the first index of the destinationlength
- the number of bytes to transferpublic void readBytes(byte[] dst)
ChannelBuffer
readerIndex
and increases the readerIndex
by the number of the transferred bytes (= dst.length
).
readBytes
in interface ChannelBuffer
readBytes
in interface MessagingBuffer
public void readBytes(ChannelBuffer dst)
ChannelBuffer
readerIndex
until the destination becomes
non-writable, and increases the readerIndex
by the number of the
transferred bytes. This method is basically same with
ChannelBuffer.readBytes(ChannelBuffer, int, int)
, except that this method
increases the writerIndex
of the destination by the number of
the transferred bytes while ChannelBuffer.readBytes(ChannelBuffer, int, int)
does not.
readBytes
in interface ChannelBuffer
public void readBytes(ChannelBuffer dst, int length)
ChannelBuffer
readerIndex
and increases the readerIndex
by the number of the transferred bytes (= length
). This method
is basically same with ChannelBuffer.readBytes(ChannelBuffer, int, int)
,
except that this method increases the writerIndex
of the
destination by the number of the transferred bytes (= length
)
while ChannelBuffer.readBytes(ChannelBuffer, int, int)
does not.
readBytes
in interface ChannelBuffer
public void readBytes(ChannelBuffer dst, int dstIndex, int length)
ChannelBuffer
readerIndex
and increases the readerIndex
by the number of the transferred bytes (= length
).
readBytes
in interface ChannelBuffer
dstIndex
- the first index of the destinationlength
- the number of bytes to transferpublic void readBytes(java.nio.ByteBuffer dst)
ChannelBuffer
readerIndex
until the destination's position
reaches its limit, and increases the readerIndex
by the
number of the transferred bytes.
readBytes
in interface ChannelBuffer
public int readBytes(java.nio.channels.GatheringByteChannel out, int length) throws java.io.IOException
ChannelBuffer
readerIndex
.
readBytes
in interface ChannelBuffer
length
- the maximum number of bytes to transfer
java.io.IOException
- if the specified channel threw an exception during I/Opublic void readBytes(java.io.OutputStream out, int length) throws java.io.IOException
ChannelBuffer
readerIndex
.
readBytes
in interface ChannelBuffer
length
- the number of bytes to transfer
java.io.IOException
- if the specified stream threw an exception during I/Opublic void skipBytes(int length)
ChannelBuffer
readerIndex
by the specified
length
in this buffer.
skipBytes
in interface ChannelBuffer
public void writeByte(byte value)
ChannelBuffer
writerIndex
and increases the writerIndex
by 1
in this buffer.
writeByte
in interface ChannelBuffer
writeByte
in interface MessagingBuffer
public void writeShort(short value)
ChannelBuffer
writerIndex
and increases the writerIndex
by 2
in this buffer.
writeShort
in interface ChannelBuffer
writeShort
in interface MessagingBuffer
public void writeMedium(int value)
ChannelBuffer
writerIndex
and increases the writerIndex
by 3
in this buffer.
writeMedium
in interface ChannelBuffer
public void writeInt(int value)
ChannelBuffer
writerIndex
and increases the writerIndex
by 4
in this buffer.
writeInt
in interface ChannelBuffer
writeInt
in interface MessagingBuffer
public void writeLong(long value)
ChannelBuffer
writerIndex
and increases the writerIndex
by 8
in this buffer.
writeLong
in interface ChannelBuffer
writeLong
in interface MessagingBuffer
public void writeBytes(byte[] src, int srcIndex, int length)
ChannelBuffer
writerIndex
and increases the writerIndex
by the number of the transferred bytes (= length
).
writeBytes
in interface ChannelBuffer
writeBytes
in interface MessagingBuffer
srcIndex
- the first index of the sourcelength
- the number of bytes to transferpublic void writeBytes(byte[] src)
ChannelBuffer
writerIndex
and increases the writerIndex
by the number of the transferred bytes (= src.length
).
writeBytes
in interface ChannelBuffer
writeBytes
in interface MessagingBuffer
public void writeBytes(ChannelBuffer src)
ChannelBuffer
writerIndex
until the source buffer becomes
unreadable, and increases the writerIndex
by the number of
the transferred bytes. This method is basically same with
ChannelBuffer.writeBytes(ChannelBuffer, int, int)
, except that this method
increases the readerIndex
of the source buffer by the number of
the transferred bytes while ChannelBuffer.writeBytes(ChannelBuffer, int, int)
does not.
writeBytes
in interface ChannelBuffer
public void writeBytes(ChannelBuffer src, int length)
ChannelBuffer
writerIndex
and increases the writerIndex
by the number of the transferred bytes (= length
). This method
is basically same with ChannelBuffer.writeBytes(ChannelBuffer, int, int)
,
except that this method increases the readerIndex
of the source
buffer by the number of the transferred bytes (= length
) while
ChannelBuffer.writeBytes(ChannelBuffer, int, int)
does not.
writeBytes
in interface ChannelBuffer
length
- the number of bytes to transferpublic void writeBytes(ChannelBuffer src, int srcIndex, int length)
ChannelBuffer
writerIndex
and increases the writerIndex
by the number of the transferred bytes (= length
).
writeBytes
in interface ChannelBuffer
srcIndex
- the first index of the sourcelength
- the number of bytes to transferpublic void writeBytes(MessagingBuffer src, int srcIndex, int length)
writeBytes
in interface MessagingBuffer
public void writeBytes(java.nio.ByteBuffer src)
ChannelBuffer
writerIndex
until the source buffer's position
reaches its limit, and increases the writerIndex
by the
number of the transferred bytes.
writeBytes
in interface ChannelBuffer
public void writeBytes(java.io.InputStream in, int length) throws java.io.IOException
ChannelBuffer
writerIndex
and increases the
writerIndex
by the number of the transferred bytes.
writeBytes
in interface ChannelBuffer
length
- the number of bytes to transfer
java.io.IOException
- if the specified stream threw an exception during I/Opublic int writeBytes(java.nio.channels.ScatteringByteChannel in, int length) throws java.io.IOException
ChannelBuffer
writerIndex
and increases the
writerIndex
by the number of the transferred bytes.
writeBytes
in interface ChannelBuffer
length
- the maximum number of bytes to transfer
java.io.IOException
- if the specified channel threw an exception during I/Opublic void writeZero(int length)
ChannelBuffer
writerIndex
and increases the writerIndex
by the
specified length
.
writeZero
in interface ChannelBuffer
length
- the number of NULs to write to the bufferpublic java.nio.ByteBuffer toByteBuffer()
ChannelBuffer
buf.toByteBuffer(buf.readerIndex(), buf.readableBytes())
.
toByteBuffer
in interface ChannelBuffer
public java.nio.ByteBuffer[] toByteBuffers()
public java.nio.ByteBuffer[] toByteBuffers(int index, int length)
ChannelBuffer
toByteBuffers
in interface ChannelBuffer
public java.lang.String toString(java.lang.String charsetName)
ChannelBuffer
buf.toString(buf.readerIndex(), buf.readableBytes(), charsetName)
.
toString
in interface ChannelBuffer
public int hashCode()
ChannelBuffer
hashCode
in interface ChannelBuffer
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
ChannelBuffer
ChannelBuffer.readerIndex()
nor
ChannelBuffer.writerIndex()
. This method also returns false
for
null
and an object which is not an instance of
ChannelBuffer
type.
equals
in interface ChannelBuffer
equals
in class java.lang.Object
public int compareTo(ChannelBuffer that)
ChannelBuffer
strcmp
,
memcmp
and String.compareTo(String)
.
compareTo
in interface java.lang.Comparable<ChannelBuffer>
compareTo
in interface ChannelBuffer
public java.lang.String toString()
ChannelBuffer
ChannelBuffer.readerIndex()
,
ChannelBuffer.writerIndex()
and ChannelBuffer.capacity()
.
toString
in interface ChannelBuffer
toString
in class java.lang.Object
protected void checkReadableBytes(int minimumReadableBytes)
IndexOutOfBoundsException
if the current
readable bytes of this buffer is less
than the specified value.
public java.lang.Object getUnderlyingBuffer()
getUnderlyingBuffer
in interface MessagingBuffer
public boolean readBoolean()
readBoolean
in interface MessagingBuffer
public char readChar()
readChar
in interface MessagingBuffer
public double readDouble()
readDouble
in interface MessagingBuffer
public float readFloat()
readFloat
in interface MessagingBuffer
public SimpleString readNullableSimpleString()
readNullableSimpleString
in interface MessagingBuffer
public java.lang.String readNullableString()
readNullableString
in interface MessagingBuffer
public SimpleString readSimpleString()
readSimpleString
in interface MessagingBuffer
public java.lang.String readString()
readString
in interface MessagingBuffer
public java.lang.String readUTF() throws java.lang.Exception
readUTF
in interface MessagingBuffer
java.lang.Exception
public void writeBoolean(boolean val)
writeBoolean
in interface MessagingBuffer
public void writeChar(char val)
writeChar
in interface MessagingBuffer
public void writeDouble(double val)
writeDouble
in interface MessagingBuffer
public void writeFloat(float val)
writeFloat
in interface MessagingBuffer
public void writeNullableSimpleString(SimpleString val)
writeNullableSimpleString
in interface MessagingBuffer
public void writeNullableString(java.lang.String val)
writeNullableString
in interface MessagingBuffer
public void writeSimpleString(SimpleString val)
writeSimpleString
in interface MessagingBuffer
public void writeString(java.lang.String val)
writeString
in interface MessagingBuffer
public void writeUTF(java.lang.String utf) throws java.lang.Exception
writeUTF
in interface MessagingBuffer
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |