GeezerVison is showing netty.io — ReadOnlyByteBuf (Netty API Reference (4.1.141.Final))
Class ReadOnlyByteBuf
-
Constructor Summary
Constructors
-
Method Summary
Modifier and Type
Method
Description
protected byte
protected int
protected int
protected long
protected long
protected short
protected short
protected int
protected int
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
byte[]
Deprecated.
Returns the backing byte array of this buffer.
int
Deprecated.
Returns the offset of the first byte within the backing byte array of
this buffer.
Deprecated.
Returns a read-only version of this buffer.
int
Deprecated.
Returns the number of bytes (octets) this buffer can contain.
Deprecated.
Adjusts the capacity of this buffer.
copy(int index,
int length)
Deprecated.
Returns a copy of this buffer's sub-region.
Deprecated.
Discards the bytes between the 0th index and readerIndex.
Deprecated.
Returns a buffer which shares the whole region of this buffer.
int
int
Deprecated.
Iterates over the specified area of this buffer with the specified processor in ascending order.
int
Deprecated.
Iterates over the specified area of this buffer with the specified processor in descending order.
byte
Deprecated.
Gets a byte at the specified absolute index in this buffer.
getBytes(int index,
byte[] dst,
int dstIndex,
int length)
Deprecated.
Transfers this buffer's data to the specified destination starting at
the specified absolute index.
Deprecated.
Transfers this buffer's data to the specified destination starting at
the specified absolute index.
Deprecated.
Transfers this buffer's data to the specified stream starting at the
specified absolute index.
Deprecated.
Transfers this buffer's data to the specified destination starting at
the specified absolute index until the destination's position
reaches its limit.
int
Deprecated.
Transfers this buffer's data starting at the specified absolute index
to the specified channel starting at the given file position.
int
Deprecated.
Transfers this buffer's data to the specified channel starting at the
specified absolute index.
int
Deprecated.
Gets a 32-bit integer at the specified absolute index in
this buffer.
int
Deprecated.
Gets a 32-bit integer at the specified absolute index in
this buffer with Little Endian Byte Order.
long
Deprecated.
Gets a 64-bit long integer at the specified absolute index in
this buffer.
long
Deprecated.
Gets a 64-bit long integer at the specified absolute index in
this buffer in Little Endian Byte Order.
short
Deprecated.
Gets a 16-bit short integer at the specified absolute index in
this buffer.
short
Deprecated.
Gets a 16-bit short integer at the specified absolute index in
this buffer in Little Endian Byte Order.
int
Deprecated.
Gets an unsigned 24-bit medium integer at the specified absolute
index in this buffer.
int
Deprecated.
Gets an unsigned 24-bit medium integer at the specified absolute
index in this buffer in Little Endian Byte Order.
boolean
Deprecated.
Returns true if and only if this buffer has a backing byte array.
boolean
Deprecated.
Returns true if and only if this buffer has a reference to the low-level memory address that points
to the backing data.
boolean
Deprecated.
Returns true if and only if this buffer is backed by an
NIO direct buffer.
boolean
Deprecated.
Returns true if and only if this buffer is read-only.
boolean
Deprecated.
Returns true
if and only if (this.capacity - this.writerIndex) is greater
than 0.
boolean
Deprecated.
Returns true if and only if this buffer has enough room to allow writing the specified number of
elements.
long
Deprecated.
Returns the low-level memory address that point to the first byte of ths backing data.
Deprecated.
Exposes this buffer's sub-region as an NIO ByteBuffer.
int
Deprecated.
Returns the maximum number of NIO ByteBuffers that consist this buffer.
Deprecated.
Exposes this buffer's bytes as an NIO ByteBuffer's for the specified index and length
The returned buffer either share or contains the copied content of this buffer, while changing
the position and limit of the returned NIO buffer does not affect the indexes and marks of this buffer.
Deprecated.
Sets the specified byte at the specified absolute index in this
buffer.
setBytes(int index,
byte[] src,
int srcIndex,
int length)
Deprecated.
Transfers the specified source array's data to this buffer starting at
the specified absolute index.
Deprecated.
Transfers the specified source buffer's data to this buffer starting at
the specified absolute index.
int
Deprecated.
Transfers the content of the specified source stream to this buffer
starting at the specified absolute index.
Deprecated.
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.
int
Deprecated.
Transfers the content of the specified source channel starting at the given file position
to this buffer starting at the specified absolute index.
int
Deprecated.
Transfers the content of the specified source channel to this buffer
starting at the specified absolute index.
Deprecated.
Sets the specified 32-bit integer at the specified absolute
index in this buffer.
Deprecated.
Sets the specified 32-bit integer at the specified absolute
index in this buffer with Little Endian byte order
.
Deprecated.
Sets the specified 64-bit long integer at the specified absolute
index in this buffer.
Deprecated.
Sets the specified 64-bit long integer at the specified absolute
index in this buffer in Little Endian Byte Order.
Deprecated.
Sets the specified 24-bit medium integer at the specified absolute
index in this buffer.
Deprecated.
Sets the specified 24-bit medium integer at the specified absolute
index in this buffer in the Little Endian Byte Order.
Deprecated.
Sets the specified 16-bit short integer at the specified absolute
index in this buffer.
Deprecated.
Sets the specified 16-bit short integer at the specified absolute
index in this buffer with the Little Endian Byte Order.
slice(int index,
int length)
Deprecated.
Returns a slice of this buffer's sub-region.
Deprecated.
Return the underlying buffer instance if this buffer is a wrapper of another buffer.
internalNioBuffer, isContiguous, refCnt, release, release, retain, retain, touch, touch
Modifier and Type
Method
Description
Deprecated.
Internal use only: Exposes the internal NIO buffer.
boolean
Deprecated.
Returns true if this ByteBuf implementation is backed by a single memory region.
final int
Deprecated.
Returns the reference count of this object.
final boolean
Deprecated.
Decreases the reference count by 1 and deallocates this object if the reference count reaches at
0.
final boolean
Deprecated.
Decreases the reference count by the specified decrement and deallocates this object if the reference
count reaches at 0.
Deprecated.
Increases the reference count by 1.
Deprecated.
Increases the reference count by the specified increment.
Deprecated.
Records the current access location of this object for debugging purposes.
Deprecated.
Records the current access location of this object with an additional arbitrary information for debugging
purposes.
adjustMarkers, bytesBefore, bytesBefore, bytesBefore, checkDstIndex, checkDstIndex, checkIndex, checkIndex, checkNewCapacity, checkReadableBytes, checkSrcIndex, clear, compareTo, copy, discardSomeReadBytes, ensureAccessible, equals, forEachByte, forEachByteDesc, getBoolean, getBytes, getBytes, getBytes, getChar, getCharSequence, getDouble, getFloat, getMedium, getMediumLE, getUnsignedByte, getUnsignedInt, getUnsignedIntLE, getUnsignedShort, getUnsignedShortLE, hashCode, indexOf, isReadable, isReadable, markReaderIndex, markWriterIndex, maxCapacity, maxCapacity, maxWritableBytes, newSwappedByteBuf, nioBuffer, nioBuffers, order, readableBytes, readBoolean, readByte, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readChar, readCharSequence, readDouble, readerIndex, readerIndex, readFloat, readInt, readIntLE, readLong, readLongLE, readMedium, readMediumLE, readRetainedSlice, readShort, readShortLE, readSlice, readUnsignedByte, readUnsignedInt, readUnsignedIntLE, readUnsignedMedium, readUnsignedMediumLE, readUnsignedShort, readUnsignedShortLE, resetReaderIndex, resetWriterIndex, retainedDuplicate, retainedSlice, retainedSlice, setBoolean, setBytes, setBytes, setBytes, setChar, setCharSequence, setDouble, setFloat, setIndex, setZero, skipBytes, slice, toString, toString, toString, trimIndicesToCapacity, writableBytes, writeBoolean, writeByte, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeChar, writeCharSequence, writeDouble, writeFloat, writeInt, writeIntLE, writeLong, writeLongLE, writeMedium, writeMediumLE, writerIndex, writerIndex, writeShort, writeShortLE, writeZero
Modifier and Type
Method
Description
protected final void
int
Locates the first occurrence of the specified value in this
buffer.
int
Locates the first occurrence of the specified value in this
buffer.
int
Locates the first occurrence of the specified value in this
buffer.
protected final void
protected final void
checkDstIndex(int index,
int length,
int dstIndex,
int dstCapacity)
protected final void
protected final void
protected final void
protected final void
protected final void
checkSrcIndex(int index,
int length,
int srcIndex,
int srcCapacity)
Sets the readerIndex and writerIndex of this buffer to
0.
int
Compares the content of the specified buffer to the content of this
buffer.
Returns a copy of this buffer's readable bytes.
Similar to ByteBuf.discardReadBytes() except that this method might discard
some, all, or none of read bytes depending on its internal implementation to reduce
overall memory bandwidth consumption at the cost of potentially additional memory
consumption.
protected final void
Should be called by every method that tries to access the buffers content to check
if the buffer was released before.
boolean
Determines if the content of the specified buffer is identical to the
content of this array.
int
Iterates over the readable bytes of this buffer with the specified processor in ascending order.
int
Iterates over the readable bytes of this buffer with the specified processor in descending order.
boolean
Gets a boolean at the specified absolute (@code index) in this buffer.
Transfers this buffer's data to the specified destination starting at
the specified absolute index.
Transfers this buffer's data to the specified destination starting at
the specified absolute index until the destination becomes
non-writable.
Transfers this buffer's data to the specified destination starting at
the specified absolute index.
char
Gets a 2-byte UTF-16 character at the specified absolute
index in this buffer.
Gets a CharSequence with the given length at the given index.
double
Gets a 64-bit floating point number at the specified absolute
index in this buffer.
float
Gets a 32-bit floating point number at the specified absolute
index in this buffer.
int
Gets a 24-bit medium integer at the specified absolute index in
this buffer.
int
Gets a 24-bit medium integer at the specified absolute index in
this buffer in the Little Endian Byte Order.
short
Gets an unsigned byte at the specified absolute index in this
buffer.
long
Gets an unsigned 32-bit integer at the specified absolute index
in this buffer.
long
Gets an unsigned 32-bit integer at the specified absolute index
in this buffer in Little Endian Byte Order.
int
Gets an unsigned 16-bit short integer at the specified absolute
index in this buffer.
int
Gets an unsigned 16-bit short integer at the specified absolute
index in this buffer in Little Endian Byte Order.
int
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.
boolean
Returns true
if and only if (this.writerIndex - this.readerIndex) is greater
than 0.
boolean
Returns true if and only if this buffer contains equal to or more than the specified number of elements.
Marks the current readerIndex in this buffer.
Marks the current writerIndex in this buffer.
int
Returns the maximum allowed capacity of this buffer.
protected final void
int
Returns the maximum possible number of writable bytes, which is equal to
(this.maxCapacity - this.writerIndex).
Exposes this buffer's readable bytes as an NIO ByteBuffer.
Exposes this buffer's readable bytes as an NIO ByteBuffer's.
Returns a buffer with the specified endianness which shares the whole region,
indexes, and marks of this buffer.
int
Returns the number of readable bytes which is equal to
(this.writerIndex - this.readerIndex).
boolean
Gets a boolean at the current readerIndex and increases
the readerIndex by 1 in this buffer.
byte
Gets a byte at the current readerIndex and increases
the readerIndex by 1 in this buffer.
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).
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).
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).
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.
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).
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).
Transfers this buffer's data to the specified stream starting at the
current readerIndex.
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.
int
Transfers this buffer's data starting at the current readerIndex
to the specified channel starting at the given file position.
int
Transfers this buffer's data to the specified stream starting at the
current readerIndex.
char
Gets a 2-byte UTF-16 character at the current readerIndex
and increases the readerIndex by 2 in this buffer.
Gets a CharSequence with the given length at the current readerIndex
and increases the readerIndex by the given length.
double
Gets a 64-bit floating point number at the current readerIndex
and increases the readerIndex by 8 in this buffer.
int
Returns the readerIndex of this buffer.
Sets the readerIndex of this buffer.
float
Gets a 32-bit floating point number at the current readerIndex
and increases the readerIndex by 4 in this buffer.
int
Gets a 32-bit integer at the current readerIndex
and increases the readerIndex by 4 in this buffer.
int
Gets a 32-bit integer at the current readerIndex
in the Little Endian Byte Order and increases the readerIndex
by 4 in this buffer.
long
Gets a 64-bit integer at the current readerIndex
and increases the readerIndex by 8 in this buffer.
long
Gets a 64-bit integer at the current readerIndex
in the Little Endian Byte Order and increases the readerIndex
by 8 in this buffer.
int
Gets a 24-bit medium integer at the current readerIndex
and increases the readerIndex by 3 in this buffer.
int
Gets a 24-bit medium integer at the current readerIndex
in the Little Endian Byte Order and increases the
readerIndex by 3 in this buffer.
Returns a new retained 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
Gets a 16-bit short integer at the current readerIndex
and increases the readerIndex by 2 in this buffer.
short
Gets a 16-bit short integer at the current readerIndex
in the Little Endian Byte Order and increases the readerIndex
by 2 in this buffer.
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
Gets an unsigned byte at the current readerIndex and increases
the readerIndex by 1 in this buffer.
long
Gets an unsigned 32-bit integer at the current readerIndex
and increases the readerIndex by 4 in this buffer.
long
Gets an unsigned 32-bit integer at the current readerIndex
in the Little Endian Byte Order and increases the readerIndex
by 4 in this buffer.
int
Gets an unsigned 24-bit medium integer at the current readerIndex
and increases the readerIndex by 3 in this buffer.
int
Gets an unsigned 24-bit medium integer at the current readerIndex
in the Little Endian Byte Order and increases the readerIndex
by 3 in this buffer.
int
Gets an unsigned 16-bit short integer at the current readerIndex
and increases the readerIndex by 2 in this buffer.
int
Gets an unsigned 16-bit short integer at the current readerIndex
in the Little Endian Byte Order and increases the readerIndex
by 2 in this buffer.
Repositions the current readerIndex to the marked
readerIndex in this buffer.
Repositions the current writerIndex to the marked
writerIndex in this buffer.
Returns a retained buffer which shares the whole region of this buffer.
Returns a retained slice of this buffer's readable bytes.
Returns a retained slice of this buffer's sub-region.
Sets the specified boolean at the specified absolute index in this
buffer.
Transfers the specified source array's data to this buffer starting at
the specified absolute index.
Transfers the specified source buffer's data to this buffer starting at
the specified absolute index until the source buffer becomes
unreadable.
Transfers the specified source buffer's data to this buffer starting at
the specified absolute index.
Sets the specified 2-byte UTF-16 character at the specified absolute
index in this buffer.
int
Sets the specified 64-bit floating-point number at the specified
absolute index in this buffer.
Sets the specified 32-bit floating-point number at the specified
absolute index in this buffer.
setIndex(int readerIndex,
int writerIndex)
Sets the readerIndex and writerIndex of this buffer
in one shot.
Fills this buffer with NUL (0x00) starting at the specified
absolute index.
Increases the current readerIndex by the specified
length in this buffer.
Returns a slice of this buffer's readable bytes.
Returns the string representation of this buffer.
Decodes this buffer's sub-region into a string with the specified
character set.
Decodes this buffer's readable bytes into a string with the specified
character set name.
protected final void
int
Returns the number of writable bytes which is equal to
(this.capacity - this.writerIndex).
Sets the specified boolean at the current writerIndex
and increases the writerIndex by 1 in this buffer.
Sets the specified byte at the current writerIndex
and increases the writerIndex by 1 in this buffer.
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).
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).
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.
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).
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
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.
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.
int
Transfers the content of the specified channel starting at the given file position
to this buffer starting at the current writerIndex and increases the
writerIndex by the number of the transferred bytes.
int
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.
Sets the specified 2-byte UTF-16 character at the current
writerIndex and increases the writerIndex by 2
in this buffer.
int
Writes the specified CharSequence at the current writerIndex and increases
the writerIndex by the written bytes.
in this buffer.
Sets the specified 64-bit floating point number at the current
writerIndex and increases the writerIndex by 8
in this buffer.
Sets the specified 32-bit floating point number at the current
writerIndex and increases the writerIndex by 4
in this buffer.
Sets the specified 32-bit integer at the current writerIndex
and increases the writerIndex by 4 in this buffer.
Sets the specified 32-bit integer at the current writerIndex
in the Little Endian Byte Order and increases the writerIndex
by 4 in this buffer.
Sets the specified 64-bit long integer at the current
writerIndex and increases the writerIndex by 8
in this buffer.
Sets the specified 64-bit long integer at the current
writerIndex in the Little Endian Byte Order and
increases the writerIndex by 8
in this buffer.
Sets the specified 24-bit medium integer at the current
writerIndex and increases the writerIndex by 3
in this buffer.
Sets the specified 24-bit medium integer at the current
writerIndex in the Little Endian Byte Order and
increases the writerIndex by 3 in this
buffer.
int
Returns the writerIndex of this buffer.
Sets the writerIndex of this buffer.
Sets the specified 16-bit short integer at the current
writerIndex and increases the writerIndex by 2
in this buffer.
Sets the specified 16-bit short integer in the Little Endian Byte
Order at the current writerIndex and increases the
writerIndex by 2 in this buffer.
Fills this buffer with NUL (0x00) starting at the current
writerIndex and increases the writerIndex by the
specified length.
Methods inherited from class ByteBuf
asByteBuf, getDoubleLE, getFloatLE, maxFastWritableBytes, readDoubleLE, readFloatLE, setDoubleLE, setFloatLE, writeDoubleLE, writeFloatLE
Modifier and Type
Method
Description
A ByteBuf can turn into itself.
double
Gets a 64-bit floating point number at the specified absolute
index in this buffer in Little Endian Byte Order.
float
Gets a 32-bit floating point number at the specified absolute
index in this buffer in Little Endian Byte Order.
int
Returns the maximum number of bytes which can be written for certain without involving
an internal reallocation or data-copy.
double
Gets a 64-bit floating point number at the current readerIndex
in Little Endian Byte Order and increases the readerIndex
by 8 in this buffer.
float
Gets a 32-bit floating point number at the current readerIndex
in Little Endian Byte Order and increases the readerIndex
by 4 in this buffer.
Sets the specified 64-bit floating-point number at the specified
absolute index in this buffer in Little Endian Byte Order.
Sets the specified 32-bit floating-point number at the specified
absolute index in this buffer in Little Endian Byte Order.
Sets the specified 64-bit floating point number at the current
writerIndex in Little Endian Byte Order and increases
the writerIndex by 8 in this buffer.
Sets the specified 32-bit floating point number at the current
writerIndex in Little Endian Byte Order and increases
the writerIndex by 4 in this buffer.
-
Constructor Details
-
ReadOnlyByteBuf
public ReadOnlyByteBuf(ByteBuf buffer)
Deprecated.
-
Method Details
-
-
isWritable
public boolean isWritable()
Deprecated.
Description copied from class: ByteBuf
Returns true
if and only if (this.capacity - this.writerIndex) is greater
than 0.
- Overrides:
isWritable in class AbstractByteBuf
-
isWritable
public boolean isWritable(int numBytes)
Deprecated.
Description copied from class: ByteBuf
Returns true if and only if this buffer has enough room to allow writing the specified number of
elements.
- Overrides:
isWritable in class AbstractByteBuf
-
ensureWritable
public int ensureWritable(int minWritableBytes,
boolean force)
Deprecated.
Description copied from class: ByteBuf
- Overrides:
ensureWritable in class AbstractByteBuf
- Parameters:
minWritableBytes - the expected minimum number of writable bytes
force - When ByteBuf.writerIndex() + minWritableBytes > ByteBuf.maxCapacity():
true - the capacity of the buffer is expanded to ByteBuf.maxCapacity()
false - the capacity of the buffer is unchanged
- Returns:
0 if the buffer has enough writable bytes, and its capacity is unchanged.
1 if the buffer does not have enough bytes, and its capacity is unchanged.
2 if the buffer has enough writable bytes, and its capacity has been increased.
3 if the buffer does not have enough bytes, but its capacity has been
increased to its maximum.
-
ensureWritable
public ByteBuf ensureWritable(int minWritableBytes)
Deprecated.
Description copied from class: ByteBuf
Expands the buffer ByteBuf.capacity() to make sure the number of
writable bytes is equal to or greater than the
specified value. If there are enough writable bytes in this buffer, this method
returns with no side effect.
- Overrides:
ensureWritable in class AbstractByteBuf
- Parameters:
minWritableBytes - the expected minimum number of writable bytes
- See Also:
-
-
unwrap
Deprecated.
Description copied from class: ByteBuf
Return the underlying buffer instance if this buffer is a wrapper of another buffer.
- Specified by:
unwrap in class ByteBuf
- Returns:
null if this buffer is not a wrapper
-
-
-
isDirect
public boolean isDirect()
Deprecated.
Description copied from class: ByteBuf
Returns true if and only if this buffer is backed by an
NIO direct buffer.
- Specified by:
isDirect in class ByteBuf
-
hasArray
public boolean hasArray()
Deprecated.
Description copied from class: ByteBuf
- Specified by:
hasArray in class ByteBuf
-
array
public byte[] array()
Deprecated.
Description copied from class: ByteBuf
Returns the backing byte array of this buffer.
- Specified by:
array in class ByteBuf
-
arrayOffset
public int arrayOffset()
Deprecated.
Description copied from class: ByteBuf
Returns the offset of the first byte within the backing byte array of
this buffer.
- Specified by:
arrayOffset in class ByteBuf
-
hasMemoryAddress
public boolean hasMemoryAddress()
Deprecated.
Description copied from class: ByteBuf
Returns true if and only if this buffer has a reference to the low-level memory address that points
to the backing data.
- Specified by:
hasMemoryAddress in class ByteBuf
-
memoryAddress
public long memoryAddress()
Deprecated.
Description copied from class: ByteBuf
Returns the low-level memory address that point to the first byte of ths backing data.
- Specified by:
memoryAddress in class ByteBuf
-
discardReadBytes
Deprecated.
Description copied from class: ByteBuf
Discards the bytes between the 0th index and 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.
- Overrides:
discardReadBytes in class AbstractByteBuf
-
setBytes
public ByteBuf setBytes(int index,
ByteBuf src,
int srcIndex,
int length)
Deprecated.
Description copied from class: ByteBuf
Transfers the specified source buffer's data to this buffer starting at
the specified absolute index.
This method does not modify readerIndex or writerIndex
of both the source (i.e. this) and the destination.
- Specified by:
setBytes in class ByteBuf
- Parameters:
srcIndex - the first index of the source
length - the number of bytes to transfer
-
setBytes
public ByteBuf setBytes(int index,
byte[] src,
int srcIndex,
int length)
Deprecated.
Description copied from class: ByteBuf
Transfers the specified source array's data to this buffer starting at
the specified absolute index.
This method does not modify readerIndex or writerIndex of
this buffer.
- Specified by:
setBytes in class ByteBuf
-
setBytes
Deprecated.
Description copied from class: ByteBuf
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.
This method does not modify readerIndex or writerIndex of
this buffer.
- Specified by:
setBytes in class ByteBuf
-
setByte
public ByteBuf setByte(int index,
int value)
Deprecated.
Description copied from class: ByteBuf
Sets the specified byte at the specified absolute index in this
buffer. The 24 high-order bits of the specified value are ignored.
This method does not modify readerIndex or writerIndex of
this buffer.
- Overrides:
setByte in class AbstractByteBuf
-
-
setShort
public ByteBuf setShort(int index,
int value)
Deprecated.
Description copied from class: ByteBuf
Sets the specified 16-bit short integer at the specified absolute
index in this buffer. The 16 high-order bits of the specified
value are ignored.
This method does not modify readerIndex or writerIndex of
this buffer.
- Overrides:
setShort in class AbstractByteBuf
-
-
setShortLE
public ByteBuf setShortLE(int index,
int value)
Deprecated.
Description copied from class: ByteBuf
Sets the specified 16-bit short integer at the specified absolute
index in this buffer with the Little Endian Byte Order.
The 16 high-order bits of the specified value are ignored.
This method does not modify readerIndex or writerIndex of
this buffer.
- Overrides:
setShortLE in class AbstractByteBuf
-
-
setMedium
public ByteBuf setMedium(int index,
int value)
Deprecated.
Description copied from class: ByteBuf
Sets the specified 24-bit medium integer at the specified absolute
index in this buffer. Please note that the most significant
byte is ignored in the specified value.
This method does not modify readerIndex or writerIndex of
this buffer.
- Overrides:
setMedium in class AbstractByteBuf
-
-
setMediumLE
public ByteBuf setMediumLE(int index,
int value)
Deprecated.
Description copied from class: ByteBuf
Sets the specified 24-bit medium integer at the specified absolute
index in this buffer in the Little Endian Byte Order.
Please note that the most significant byte is ignored in the
specified value.
This method does not modify readerIndex or writerIndex of
this buffer.
- Overrides:
setMediumLE in class AbstractByteBuf
-
-
setInt
public ByteBuf setInt(int index,
int value)
Deprecated.
Description copied from class: ByteBuf
Sets the specified 32-bit integer at the specified absolute
index in this buffer.
This method does not modify readerIndex or writerIndex of
this buffer.
- Overrides:
setInt in class AbstractByteBuf
-
-
setIntLE
public ByteBuf setIntLE(int index,
int value)
Deprecated.
Description copied from class: ByteBuf
Sets the specified 32-bit integer at the specified absolute
index in this buffer with Little Endian byte order
.
This method does not modify readerIndex or writerIndex of
this buffer.
- Overrides:
setIntLE in class AbstractByteBuf
-
-
setLong
public ByteBuf setLong(int index,
long value)
Deprecated.
Description copied from class: ByteBuf
Sets the specified 64-bit long integer at the specified absolute
index in this buffer.
This method does not modify readerIndex or writerIndex of
this buffer.
- Overrides:
setLong in class AbstractByteBuf
-
-
setLongLE
public ByteBuf setLongLE(int index,
long value)
Deprecated.
Description copied from class: ByteBuf
Sets the specified 64-bit long integer at the specified absolute
index in this buffer in Little Endian Byte Order.
This method does not modify readerIndex or writerIndex of
this buffer.
- Overrides:
setLongLE in class AbstractByteBuf
-
-
setBytes
public int setBytes(int index,
InputStream in,
int length)
Deprecated.
Description copied from class: ByteBuf
Transfers the content of the specified source stream to this buffer
starting at the specified absolute index.
This method does not modify readerIndex or writerIndex of
this buffer.
- Specified by:
setBytes in class ByteBuf
- Parameters:
length - the number of bytes to transfer
- Returns:
- the actual number of bytes read in from the specified channel.
-1 if the specified InputStream reached EOF.
-
setBytes
Deprecated.
Description copied from class: ByteBuf
Transfers the content of the specified source channel to this buffer
starting at the specified absolute index.
This method does not modify readerIndex or writerIndex of
this buffer.
- Specified by:
setBytes in class ByteBuf
- Parameters:
length - the maximum number of bytes to transfer
- Returns:
- the actual number of bytes read in from the specified channel.
-1 if the specified channel is closed or it reached EOF.
-
setBytes
public int setBytes(int index,
FileChannel in,
long position,
int length)
Deprecated.
Description copied from class: ByteBuf
Transfers the content of the specified source channel starting at the given file position
to this buffer starting at the specified absolute index.
This method does not modify readerIndex or writerIndex of
this buffer. This method does not modify the channel's position.
- Specified by:
setBytes in class ByteBuf
- Parameters:
position - the file position at which the transfer is to begin
length - the maximum number of bytes to transfer
- Returns:
- the actual number of bytes read in from the specified channel.
-1 if the specified channel is closed or it reached EOF.
-
getBytes
Deprecated.
Description copied from class: ByteBuf
Transfers this buffer's data to the specified channel starting at the
specified absolute index.
This method does not modify readerIndex or writerIndex of
this buffer.
- Specified by:
getBytes in class ByteBuf
- Parameters:
length - the maximum number of bytes to transfer
- Returns:
- the actual number of bytes written out to the specified channel
- Throws:
IOException - if the specified channel threw an exception during I/O
-
getBytes
Deprecated.
Description copied from class: ByteBuf
Transfers this buffer's data starting at the specified absolute index
to the specified channel starting at the given file position.
This method does not modify readerIndex or writerIndex of
this buffer. This method does not modify the channel's position.
- Specified by:
getBytes in class ByteBuf
- Parameters:
position - the file position at which the transfer is to begin
length - the maximum number of bytes to transfer
- Returns:
- the actual number of bytes written out to the specified channel
- Throws:
IOException - if the specified channel threw an exception during I/O
-
getBytes
Deprecated.
Description copied from class: ByteBuf
Transfers this buffer's data to the specified stream starting at the
specified absolute index.
This method does not modify readerIndex or writerIndex of
this buffer.
- Specified by:
getBytes in class ByteBuf
- Parameters:
length - the number of bytes to transfer
- Throws:
IOException - if the specified stream threw an exception during I/O
-
getBytes
public ByteBuf getBytes(int index,
byte[] dst,
int dstIndex,
int length)
Deprecated.
Description copied from class: ByteBuf
Transfers this buffer's data to the specified destination starting at
the specified absolute index.
This method does not modify readerIndex or writerIndex
of this buffer.
- Specified by:
getBytes in class ByteBuf
- Parameters:
dstIndex - the first index of the destination
length - the number of bytes to transfer
-
getBytes
public ByteBuf getBytes(int index,
ByteBuf dst,
int dstIndex,
int length)
Deprecated.
Description copied from class: ByteBuf
Transfers this buffer's data to the specified destination starting at
the specified absolute index.
This method does not modify readerIndex or writerIndex
of both the source (i.e. this) and the destination.
- Specified by:
getBytes in class ByteBuf
- Parameters:
dstIndex - the first index of the destination
length - the number of bytes to transfer
-
getBytes
Deprecated.
Description copied from class: ByteBuf
Transfers this buffer's data to the specified destination starting at
the specified absolute index until the destination's position
reaches its limit.
This method does not modify readerIndex or writerIndex of
this buffer while the destination's position will be increased.
- Specified by:
getBytes in class ByteBuf
-
duplicate
Deprecated.
Description copied from class: ByteBuf
Returns a buffer which shares the whole region of this buffer.
Modifying the content of the returned buffer or this buffer affects
each other's content while they maintain separate indexes and marks.
This method does not modify readerIndex or writerIndex of
this buffer.
The reader and writer marks will not be duplicated. Also be aware that this method will
NOT call ByteBuf.retain() and so the reference count will NOT be increased.
- Overrides:
duplicate in class AbstractByteBuf
- Returns:
- A buffer whose readable content is equivalent to the buffer returned by
ByteBuf.slice().
However this buffer will share the capacity of the underlying buffer, and therefore allows access to all of the
underlying content if necessary.
-
copy
public ByteBuf copy(int index,
int length)
Deprecated.
Description copied from class: ByteBuf
Returns a copy of this buffer's sub-region. Modifying the content of
the returned buffer or this buffer does not affect each other at all.
This method does not modify readerIndex or writerIndex of
this buffer.
- Specified by:
copy in class ByteBuf
-
slice
public ByteBuf slice(int index,
int length)
Deprecated.
Description copied from class: ByteBuf
Returns a slice of this buffer's sub-region. Modifying the content of
the returned buffer or this buffer affects each other's content while
they maintain separate indexes and marks.
This method does not modify readerIndex or writerIndex of
this buffer.
Also be aware that this method will NOT call ByteBuf.retain() and so the
reference count will NOT be increased.
- Overrides:
slice in class AbstractByteBuf
-
getByte
public byte getByte(int index)
Deprecated.
Description copied from class: ByteBuf
Gets a byte at the specified absolute index in this buffer.
This method does not modify readerIndex or writerIndex of
this buffer.
- Overrides:
getByte in class AbstractByteBuf
-
-
getShort
public short getShort(int index)
Deprecated.
Description copied from class: ByteBuf
Gets a 16-bit short integer at the specified absolute index in
this buffer. This method does not modify readerIndex or
writerIndex of this buffer.
- Overrides:
getShort in class AbstractByteBuf
-
-
getShortLE
public short getShortLE(int index)
Deprecated.
Description copied from class: ByteBuf
Gets a 16-bit short integer at the specified absolute index in
this buffer in Little Endian Byte Order. This method does not modify
readerIndex or writerIndex of this buffer.
- Overrides:
getShortLE in class AbstractByteBuf
-
-
getUnsignedMedium
public int getUnsignedMedium(int index)
Deprecated.
Description copied from class: ByteBuf
Gets an unsigned 24-bit medium integer at the specified absolute
index in this buffer. This method does not modify
readerIndex or writerIndex of this buffer.
- Overrides:
getUnsignedMedium in class AbstractByteBuf
-
-
getUnsignedMediumLE
public int getUnsignedMediumLE(int index)
Deprecated.
Description copied from class: ByteBuf
Gets an unsigned 24-bit medium integer at the specified absolute
index in this buffer in Little Endian Byte Order.
This method does not modify readerIndex or
writerIndex of this buffer.
- Overrides:
getUnsignedMediumLE in class AbstractByteBuf
-
-
getInt
public int getInt(int index)
Deprecated.
Description copied from class: ByteBuf
Gets a 32-bit integer at the specified absolute index in
this buffer. This method does not modify readerIndex or
writerIndex of this buffer.
- Overrides:
getInt in class AbstractByteBuf
-
-
getIntLE
public int getIntLE(int index)
Deprecated.
Description copied from class: ByteBuf
Gets a 32-bit integer at the specified absolute index in
this buffer with Little Endian Byte Order. This method does not
modify readerIndex or writerIndex of this buffer.
- Overrides:
getIntLE in class AbstractByteBuf
-
-
getLong
public long getLong(int index)
Deprecated.
Description copied from class: ByteBuf
Gets a 64-bit long integer at the specified absolute index in
this buffer. This method does not modify readerIndex or
writerIndex of this buffer.
- Overrides:
getLong in class AbstractByteBuf
-
-
getLongLE
public long getLongLE(int index)
Deprecated.
Description copied from class: ByteBuf
Gets a 64-bit long integer at the specified absolute index in
this buffer in Little Endian Byte Order. This method does not
modify readerIndex or writerIndex of this buffer.
- Overrides:
getLongLE in class AbstractByteBuf
-
-
nioBufferCount
public int nioBufferCount()
Deprecated.
Description copied from class: ByteBuf
- Specified by:
nioBufferCount in class ByteBuf
- Returns:
-1 if this buffer has no underlying ByteBuffer.
the number of the underlying ByteBuffers if this buffer has at least one underlying
ByteBuffer. Note that this method does not return 0 to avoid confusion.
- See Also:
-
-
nioBuffer
public ByteBuffer nioBuffer(int index,
int length)
Deprecated.
Description copied from class: ByteBuf
Exposes this buffer's sub-region as an NIO ByteBuffer. The returned buffer
either share or contains the copied content of this buffer, while changing the position
and limit of the returned NIO buffer does not affect the indexes and marks of this buffer.
This method does not modify readerIndex or writerIndex of this buffer.
Please note that the returned NIO buffer will not see the changes of this buffer if this buffer
is a dynamic buffer and it adjusted its capacity.
- Overrides:
nioBuffer in class AbstractDerivedByteBuf
- See Also:
-
-
nioBuffers
public ByteBuffer[] nioBuffers(int index,
int length)
Deprecated.
Description copied from class: ByteBuf
Exposes this buffer's bytes as an NIO ByteBuffer's for the specified index and length
The returned buffer either share or contains the copied content of this buffer, while changing
the position and limit of the returned NIO buffer does not affect the indexes and marks of this buffer.
This method does not modify readerIndex or writerIndex of this buffer. Please note that the
returned NIO buffer will not see the changes of this buffer if this buffer is a dynamic
buffer and it adjusted its capacity.
- Specified by:
nioBuffers in class ByteBuf
- See Also:
-
-
forEachByte
public int forEachByte(int index,
int length,
ByteProcessor processor)
Deprecated.
Description copied from class: ByteBuf
Iterates over the specified area of this buffer with the specified processor in ascending order.
(i.e. index, (index + 1), .. (index + length - 1))
- Overrides:
forEachByte in class AbstractByteBuf
- Returns:
-1 if the processor iterated to or beyond the end of the specified area.
The last-visited index If the ByteProcessor.process(byte) returned false.
-
forEachByteDesc
public int forEachByteDesc(int index,
int length,
ByteProcessor processor)
Deprecated.
Description copied from class: ByteBuf
Iterates over the specified area of this buffer with the specified processor in descending order.
(i.e. (index + length - 1), (index + length - 2), ... index)
- Overrides:
forEachByteDesc in class AbstractByteBuf
- Returns:
-1 if the processor iterated to or beyond the beginning of the specified area.
The last-visited index If the ByteProcessor.process(byte) returned false.
-
capacity
public int capacity()
Deprecated.
Description copied from class: ByteBuf
Returns the number of bytes (octets) this buffer can contain.
- Specified by:
capacity in class ByteBuf
-
capacity
public ByteBuf capacity(int newCapacity)
Deprecated.
Description copied from class: ByteBuf
Adjusts the capacity of this buffer. If the newCapacity is less than the current
capacity, the content of this buffer is truncated. If the newCapacity is greater
than the current capacity, the buffer is appended with unspecified data whose length is
(newCapacity - currentCapacity).
- Specified by:
capacity in class ByteBuf
-
|