
public abstract class AbstractChannelBuffer extends Object implements ChannelBuffer
| Constructor and Description |
|---|
AbstractChannelBuffer() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
ChannelBuffer |
copy()
Returns a copy of this buffer's readable bytes.
|
void |
discardReadBytes()
Discards the bytes between the 0th index and
readerIndex. |
boolean |
equals(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. |
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.
|
int |
indexOf(int fromIndex,
int toIndex,
byte value)
Locates the first occurrence of the specified
value in this
buffer. |
int |
indexOf(int fromIndex,
int toIndex,
ChannelBufferIndexFinder indexFinder)
Locates the first index where the specified
indexFinder
returns true. |
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). |
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(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. |
ChannelBuffer |
readBytes(ChannelBufferIndexFinder endIndexFinder)
Transfers this buffer's data to a newly created buffer starting at
the current
readerIndex until the specified indexFinder
returns true 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(GatheringByteChannel out,
int length)
Transfers this buffer's data to the specified stream starting at the
current
readerIndex. |
ChannelBuffer |
readBytes(int length)
Transfers this buffer's data to a newly created buffer starting at
the current
readerIndex and increases the readerIndex
by the number of the transferred bytes (= length). |
void |
readBytes(OutputStream out,
int length)
Transfers this buffer's data to the specified stream starting at the
current
readerIndex. |
int |
readerIndex()
Returns the
readerIndex of this buffer. |
void |
readerIndex(int readerIndex)
Sets the
readerIndex of this buffer. |
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. |
short |
readShort()
Gets a 16-bit short integer at the current
readerIndex
and increases the readerIndex by 2 in this buffer. |
ChannelBuffer |
readSlice(ChannelBufferIndexFinder endIndexFinder)
Returns a new slice of this buffer's sub-region starting at the current
readerIndex and increases the readerIndex by the size
of the new slice (determined by indexFinder). |
ChannelBuffer |
readSlice(int length)
Returns a new slice of this buffer's sub-region starting at the current
readerIndex and increases the readerIndex by the size
of the new slice (= length). |
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. |
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. |
int |
skipBytes(ChannelBufferIndexFinder firstIndexFinder)
Increases the current
readerIndex until the specified
indexFinder returns true in this buffer. |
void |
skipBytes(int length)
Increases the current
readerIndex by the specified
length in this buffer. |
ChannelBuffer |
slice()
Returns a slice of this buffer's readable bytes.
|
ByteBuffer |
toByteBuffer()
Converts this buffer's readable bytes into a NIO buffer.
|
ByteBuffer[] |
toByteBuffers()
Converts this buffer's readable bytes into an array of NIO buffers.
|
ByteBuffer[] |
toByteBuffers(int index,
int length)
Converts this buffer's sub-region into an array of NIO buffers.
|
String |
toString()
Returns the string representation of this buffer.
|
String |
toString(int index,
int length,
String charsetName,
ChannelBufferIndexFinder terminatorFinder)
Decodes this buffer's readable bytes into a string until the specified
terminatorFinder returns true with the specified
character set name. |
String |
toString(String charsetName)
Decodes this buffer's readable bytes into a string with the specified
character set name.
|
String |
toString(String charsetName,
ChannelBufferIndexFinder terminatorFinder)
Decodes this buffer's readable bytes into a string until the specified
terminatorFinder returns true 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 |
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(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). |
int |
writeBytes(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. |
int |
writeBytes(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 |
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. |
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 |
writeZero(int length)
Fills this buffer with NUL (0x00) starting at the current
writerIndex and increases the writerIndex by the
specified length. |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcapacity, copy, duplicate, factory, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getInt, getLong, getShort, getUnsignedMedium, order, setByte, setBytes, setBytes, setBytes, setBytes, setBytes, setInt, setLong, setMedium, setShort, slice, toByteBuffer, toStringpublic int readerIndex()
ChannelBufferreaderIndex of this buffer.readerIndex in interface ChannelBufferpublic void readerIndex(int readerIndex)
ChannelBufferreaderIndex of this buffer.readerIndex in interface ChannelBufferpublic int writerIndex()
ChannelBufferwriterIndex of this buffer.writerIndex in interface ChannelBufferpublic void writerIndex(int writerIndex)
ChannelBufferwriterIndex of this buffer.writerIndex in interface ChannelBufferpublic void setIndex(int readerIndex,
int writerIndex)
ChannelBufferreaderIndex 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 ChannelBufferpublic void clear()
ChannelBufferreaderIndex 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 ChannelBufferpublic boolean readable()
ChannelBuffertrue
if and only if (this.writerIndex - this.readerIndex) is greater
than 0.readable in interface ChannelBufferpublic boolean writable()
ChannelBuffertrue
if and only if (this.capacity - this.writerIndex) is greater
than 0.writable in interface ChannelBufferpublic int readableBytes()
ChannelBuffer(this.writerIndex - this.readerIndex).readableBytes in interface ChannelBufferpublic int writableBytes()
ChannelBuffer(this.capacity - this.writerIndex).writableBytes in interface ChannelBufferpublic void markReaderIndex()
ChannelBufferreaderIndex 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 ChannelBufferpublic void resetReaderIndex()
ChannelBufferreaderIndex to the marked
readerIndex in this buffer.resetReaderIndex in interface ChannelBufferpublic void markWriterIndex()
ChannelBufferwriterIndex 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 ChannelBufferpublic void resetWriterIndex()
ChannelBufferwriterIndex to the marked
writerIndex in this buffer.resetWriterIndex in interface ChannelBufferpublic void discardReadBytes()
ChannelBufferreaderIndex.
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 ChannelBufferpublic short getUnsignedByte(int index)
ChannelBufferindex in this
buffer. This method does not modify readerIndex or
writerIndex of this buffer.getUnsignedByte in interface ChannelBufferpublic int getUnsignedShort(int index)
ChannelBufferindex in this buffer. This method does not modify
readerIndex or writerIndex of this buffer.getUnsignedShort in interface ChannelBufferpublic int getMedium(int index)
ChannelBufferindex in
this buffer. This method does not modify readerIndex or
writerIndex of this buffer.getMedium in interface ChannelBufferpublic long getUnsignedInt(int index)
ChannelBufferindex
in this buffer. This method does not modify readerIndex or
writerIndex of this buffer.getUnsignedInt in interface ChannelBufferpublic void getBytes(int index,
byte[] dst)
ChannelBufferindex.
This method does not modify readerIndex or writerIndex of
this buffergetBytes in interface ChannelBufferpublic void getBytes(int index,
ChannelBuffer dst)
ChannelBufferindex 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.
This method does not modify readerIndex or writerIndex of
the source buffer (i.e. this).getBytes in interface ChannelBufferpublic void getBytes(int index,
ChannelBuffer dst,
int length)
ChannelBufferindex. 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.
This method does not modify readerIndex or writerIndex of
the source buffer (i.e. this).getBytes in interface ChannelBufferlength - the number of bytes to transferpublic void setBytes(int index,
byte[] src)
ChannelBufferindex.
This method does not modify readerIndex or writerIndex of
this buffer.setBytes in interface ChannelBufferpublic void setBytes(int index,
ChannelBuffer src)
ChannelBufferindex 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.
This method does not modify readerIndex or writerIndex of
the source buffer (i.e. this).setBytes in interface ChannelBufferpublic void setBytes(int index,
ChannelBuffer src,
int length)
ChannelBufferindex. 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.
This method does not modify readerIndex or writerIndex of
the source buffer (i.e. this).setBytes in interface ChannelBufferlength - the number of bytes to transferpublic void setZero(int index,
int length)
ChannelBufferindex.
This method does not modify readerIndex or writerIndex of
this buffer.setZero in interface ChannelBufferlength - the number of NULs to write to the bufferpublic byte readByte()
ChannelBufferreaderIndex and increases
the readerIndex by 1 in this buffer.readByte in interface ChannelBufferpublic short readUnsignedByte()
ChannelBufferreaderIndex and increases
the readerIndex by 1 in this buffer.readUnsignedByte in interface ChannelBufferpublic short readShort()
ChannelBufferreaderIndex
and increases the readerIndex by 2 in this buffer.readShort in interface ChannelBufferpublic int readUnsignedShort()
ChannelBufferreaderIndex
and increases the readerIndex by 2 in this buffer.readUnsignedShort in interface ChannelBufferpublic int readMedium()
ChannelBufferreaderIndex
and increases the readerIndex by 3 in this buffer.readMedium in interface ChannelBufferpublic int readUnsignedMedium()
ChannelBufferreaderIndex
and increases the readerIndex by 3 in this buffer.readUnsignedMedium in interface ChannelBufferpublic int readInt()
ChannelBufferreaderIndex
and increases the readerIndex by 4 in this buffer.readInt in interface ChannelBufferpublic long readUnsignedInt()
ChannelBufferreaderIndex
and increases the readerIndex by 4 in this buffer.readUnsignedInt in interface ChannelBufferpublic long readLong()
ChannelBufferreaderIndex
and increases the readerIndex by 8 in this buffer.readLong in interface ChannelBufferpublic ChannelBuffer readBytes(int length)
ChannelBufferreaderIndex and increases the readerIndex
by the number of the transferred bytes (= length).
The returned buffer's readerIndex and writerIndex are
0 and length respectively.readBytes in interface ChannelBufferlength - the number of bytes to transferpublic ChannelBuffer readBytes(ChannelBufferIndexFinder endIndexFinder)
ChannelBufferreaderIndex until the specified indexFinder
returns true and increases the readerIndex
by the number of the transferred bytes. The returned buffer's
readerIndex and writerIndex are 0 and
the number of the transferred bytes respectively.readBytes in interface ChannelBufferendIndexFinder - finds the end index of the sub-regionpublic ChannelBuffer readSlice(int length)
ChannelBufferreaderIndex and increases the readerIndex by the size
of the new slice (= length).readSlice in interface ChannelBufferlength - the size of the new slicepublic ChannelBuffer readSlice(ChannelBufferIndexFinder endIndexFinder)
ChannelBufferreaderIndex and increases the readerIndex by the size
of the new slice (determined by indexFinder).readSlice in interface ChannelBufferendIndexFinder - finds the end index of the sub-regionpublic void readBytes(byte[] dst,
int dstIndex,
int length)
ChannelBufferreaderIndex and increases the readerIndex
by the number of the transferred bytes (= length).readBytes in interface ChannelBufferdstIndex - the first index of the destinationlength - the number of bytes to transferpublic void readBytes(byte[] dst)
ChannelBufferreaderIndex and increases the readerIndex
by the number of the transferred bytes (= dst.length).readBytes in interface ChannelBufferpublic void readBytes(ChannelBuffer dst)
ChannelBufferreaderIndex 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 ChannelBufferpublic void readBytes(ChannelBuffer dst, int length)
ChannelBufferreaderIndex 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 ChannelBufferpublic void readBytes(ChannelBuffer dst, int dstIndex, int length)
ChannelBufferreaderIndex and increases the readerIndex
by the number of the transferred bytes (= length).readBytes in interface ChannelBufferdstIndex - the first index of the destinationlength - the number of bytes to transferpublic void readBytes(ByteBuffer dst)
ChannelBufferreaderIndex until the destination's position
reaches its limit, and increases the readerIndex by the
number of the transferred bytes.readBytes in interface ChannelBufferpublic int readBytes(GatheringByteChannel out, int length) throws IOException
ChannelBufferreaderIndex.readBytes in interface ChannelBufferlength - the maximum number of bytes to transferIOException - if the specified channel threw an exception during I/Opublic void readBytes(OutputStream out, int length) throws IOException
ChannelBufferreaderIndex.readBytes in interface ChannelBufferlength - the number of bytes to transferIOException - if the specified stream threw an exception during I/Opublic void skipBytes(int length)
ChannelBufferreaderIndex by the specified
length in this buffer.skipBytes in interface ChannelBufferpublic int skipBytes(ChannelBufferIndexFinder firstIndexFinder)
ChannelBufferreaderIndex until the specified
indexFinder returns true in this buffer.skipBytes in interface ChannelBufferpublic void writeByte(byte value)
ChannelBufferwriterIndex
and increases the writerIndex by 1 in this buffer.writeByte in interface ChannelBufferpublic void writeShort(short value)
ChannelBufferwriterIndex and increases the writerIndex by 2
in this buffer.writeShort in interface ChannelBufferpublic void writeMedium(int value)
ChannelBufferwriterIndex and increases the writerIndex by 3
in this buffer.writeMedium in interface ChannelBufferpublic void writeInt(int value)
ChannelBufferwriterIndex
and increases the writerIndex by 4 in this buffer.writeInt in interface ChannelBufferpublic void writeLong(long value)
ChannelBufferwriterIndex and increases the writerIndex by 8
in this buffer.writeLong in interface ChannelBufferpublic void writeBytes(byte[] src,
int srcIndex,
int length)
ChannelBufferwriterIndex and increases the writerIndex
by the number of the transferred bytes (= length).writeBytes in interface ChannelBuffersrcIndex - the first index of the sourcelength - the number of bytes to transferpublic void writeBytes(byte[] src)
ChannelBufferwriterIndex and increases the writerIndex
by the number of the transferred bytes (= src.length).writeBytes in interface ChannelBufferpublic void writeBytes(ChannelBuffer src)
ChannelBufferwriterIndex 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 ChannelBufferpublic void writeBytes(ChannelBuffer src, int length)
ChannelBufferwriterIndex 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 ChannelBufferlength - the number of bytes to transferpublic void writeBytes(ChannelBuffer src, int srcIndex, int length)
ChannelBufferwriterIndex and increases the writerIndex
by the number of the transferred bytes (= length).writeBytes in interface ChannelBuffersrcIndex - the first index of the sourcelength - the number of bytes to transferpublic void writeBytes(ByteBuffer src)
ChannelBufferwriterIndex until the source buffer's position
reaches its limit, and increases the writerIndex by the
number of the transferred bytes.writeBytes in interface ChannelBufferpublic int writeBytes(InputStream in, int length) throws IOException
ChannelBufferwriterIndex and increases the
writerIndex by the number of the transferred bytes.writeBytes in interface ChannelBufferlength - the number of bytes to transferIOException - if the specified stream threw an exception during I/Opublic int writeBytes(ScatteringByteChannel in, int length) throws IOException
ChannelBufferwriterIndex and increases the
writerIndex by the number of the transferred bytes.writeBytes in interface ChannelBufferlength - the maximum number of bytes to transferIOException - if the specified channel threw an exception during I/Opublic void writeZero(int length)
ChannelBufferwriterIndex and increases the writerIndex by the
specified length.writeZero in interface ChannelBufferlength - the number of NULs to write to the bufferpublic ChannelBuffer copy()
ChannelBufferbuf.copy(buf.readerIndex(), buf.readableBytes()).
This method does not modify readerIndex or writerIndex of
this buffer.copy in interface ChannelBufferpublic ChannelBuffer slice()
ChannelBufferbuf.slice(buf.readerIndex(), buf.readableBytes()).
This method does not modify readerIndex or writerIndex of
this buffer.slice in interface ChannelBufferpublic ByteBuffer toByteBuffer()
ChannelBufferbuf.toByteBuffer(buf.readerIndex(), buf.readableBytes()).
This method does not modify readerIndex or writerIndex of
this buffer.toByteBuffer in interface ChannelBufferpublic ByteBuffer[] toByteBuffers()
ChannelBufferbuf.toByteBuffers(buf.readerIndex(), buf.readableBytes()).
This method does not modify readerIndex or writerIndex of
this buffer.toByteBuffers in interface ChannelBufferpublic ByteBuffer[] toByteBuffers(int index, int length)
ChannelBufferreaderIndex or writerIndex of
this buffer.toByteBuffers in interface ChannelBufferpublic String toString(String charsetName)
ChannelBufferbuf.toString(buf.readerIndex(), buf.readableBytes(), charsetName).
This method does not modify readerIndex or writerIndex of
this buffer.toString in interface ChannelBufferpublic String toString(String charsetName, ChannelBufferIndexFinder terminatorFinder)
ChannelBufferterminatorFinder returns true with the specified
character set name. This method is identical to
buf.toString(buf.readerIndex(), buf.readableBytes(), charsetName, terminatorFinder).
This method does not modify readerIndex or writerIndex of
this buffer.toString in interface ChannelBufferpublic String toString(int index, int length, String charsetName, ChannelBufferIndexFinder terminatorFinder)
ChannelBufferterminatorFinder returns true with the specified
character set name.
This method does not modify readerIndex or writerIndex of
this buffer.toString in interface ChannelBufferpublic int indexOf(int fromIndex,
int toIndex,
byte value)
ChannelBuffervalue in this
buffer. The search takes place from the specified fromIndex
(inclusive) to the specified toIndex (exclusive).
If fromIndex is greater than toIndex, the search is
performed in a reversed order.
This method does not modify readerIndex or writerIndex of
this buffer.
indexOf in interface ChannelBuffer-1 otherwise.public int indexOf(int fromIndex,
int toIndex,
ChannelBufferIndexFinder indexFinder)
ChannelBufferindexFinder
returns true. The search takes place from the specified
fromIndex (inclusive) to the specified toIndex
(exclusive).
If fromIndex is greater than toIndex, the search is
performed in a reversed order.
This method does not modify readerIndex or writerIndex of
this buffer.
indexOf in interface ChannelBufferindexFinder
returned true if the indexFinder returned
true. -1 otherwise.public int hashCode()
ChannelBufferhashCode in interface ChannelBufferhashCode in class Objectpublic boolean equals(Object o)
ChannelBufferChannelBuffer.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 ChannelBufferequals in class Objectpublic int compareTo(ChannelBuffer that)
ChannelBufferstrcmp,
memcmp and String.compareTo(String).compareTo in interface Comparable<ChannelBuffer>compareTo in interface ChannelBufferpublic String toString()
ChannelBufferChannelBuffer.readerIndex(),
ChannelBuffer.writerIndex() and ChannelBuffer.capacity().toString in interface ChannelBuffertoString in class Objectprotected void checkReadableBytes(int minimumReadableBytes)
IndexOutOfBoundsException if the current
readable bytes of this buffer is less
than the specified value.Copyright © 2008-2013 JBoss, by Red Hat. All Rights Reserved.