GeezerVison is showing netty.io — AbstractReferenceCountedByteBuf (Netty API Reference (4.1.141.Final))
Class AbstractReferenceCountedByteBuf
-
Constructor Summary
Constructors
Modifier
Constructor
Description
protected
-
Method Summary
Modifier and Type
Method
Description
protected abstract void
int
Returns the reference count of this object.
boolean
Decreases the reference count by 1 and deallocates this object if the reference count reaches at
0.
boolean
Decreases the reference count by the specified decrement and deallocates this object if the reference
count reaches at 0.
protected final void
An unsafe operation intended for use by a subclass that resets the reference count of the buffer to 1
Increases the reference count by 1.
Increases the reference count by the specified increment.
protected final void
An unsafe operation intended for use by a subclass that sets the reference count of the buffer directly
Records the current access location of this object for debugging purposes.
Records the current access location of this object with an additional arbitrary information for debugging
purposes.
_getByte, _getInt, _getIntLE, _getLong, _getLongLE, _getShort, _getShortLE, _getUnsignedMedium, _getUnsignedMediumLE, _setByte, _setInt, _setIntLE, _setLong, _setLongLE, _setMedium, _setMediumLE, _setShort, _setShortLE, adjustMarkers, asReadOnly, bytesBefore, bytesBefore, bytesBefore, checkDstIndex, checkDstIndex, checkIndex, checkIndex, checkNewCapacity, checkReadableBytes, checkSrcIndex, clear, compareTo, copy, discardReadBytes, discardSomeReadBytes, duplicate, ensureAccessible, ensureWritable, ensureWritable, equals, forEachByte, forEachByte, forEachByteDesc, forEachByteDesc, getBoolean, getByte, getBytes, getBytes, getBytes, getChar, getCharSequence, getDouble, getFloat, getInt, getIntLE, getLong, getLongLE, getMedium, getMediumLE, getShort, getShortLE, getUnsignedByte, getUnsignedInt, getUnsignedIntLE, getUnsignedMedium, getUnsignedMediumLE, getUnsignedShort, getUnsignedShortLE, hashCode, indexOf, isReadable, isReadable, isReadOnly, isWritable, isWritable, 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, setByte, setBytes, setBytes, setBytes, setChar, setCharSequence, setDouble, setFloat, setIndex, setInt, setIntLE, setLong, setLongLE, setMedium, setMediumLE, setShort, setShortLE, setZero, skipBytes, slice, 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 abstract byte
protected abstract int
protected abstract int
protected abstract long
protected abstract long
protected abstract short
protected abstract short
protected abstract int
protected abstract int
protected abstract void
protected abstract void
protected abstract void
protected abstract void
protected abstract void
protected abstract void
protected abstract void
protected abstract void
protected abstract void
protected final void
Returns a read-only version of 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.
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.
Discards the bytes between the 0th index and readerIndex.
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.
Returns a buffer which shares the whole region of this buffer.
protected final void
Should be called by every method that tries to access the buffers content to check
if the buffer was released before.
int
boolean
Determines if the content of the specified buffer is identical to the
content of this array.
int
Iterates over the specified area of this buffer with the specified processor in ascending order.
int
Iterates over the readable bytes of this buffer with the specified processor in ascending order.
int
Iterates over the specified area of this buffer with the specified processor in descending 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.
byte
Gets a byte at the specified absolute 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 32-bit integer at the specified absolute index in
this buffer.
int
Gets a 32-bit integer at the specified absolute index in
this buffer with Little Endian Byte Order.
long
Gets a 64-bit long integer at the specified absolute index in
this buffer.
long
Gets a 64-bit long integer at the specified absolute index in
this buffer in Little Endian Byte Order.
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 a 16-bit short integer at the specified absolute index in
this buffer.
short
Gets a 16-bit short integer at the specified absolute index in
this buffer in 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 24-bit medium integer at the specified absolute
index in this buffer.
int
Gets an unsigned 24-bit medium 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.
boolean
Returns true if and only if this buffer is read-only.
boolean
Returns true
if and only if (this.capacity - this.writerIndex) is greater
than 0.
boolean
Returns true if and only if this buffer has enough room to allow writing 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.
Sets the specified byte 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.
Sets the specified 32-bit integer at the specified absolute
index in this buffer.
Sets the specified 32-bit integer at the specified absolute
index in this buffer with Little Endian byte order
.
Sets the specified 64-bit long integer at the specified absolute
index in this buffer.
Sets the specified 64-bit long integer at the specified absolute
index in this buffer in Little Endian Byte Order.
Sets the specified 24-bit medium integer at the specified absolute
index in this buffer.
Sets the specified 24-bit medium integer at the specified absolute
index in this buffer in the Little Endian Byte Order.
Sets the specified 16-bit short integer at the specified absolute
index in this buffer.
Sets the specified 16-bit short integer at the specified absolute
index in this buffer with the Little Endian Byte Order.
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.
slice(int index,
int length)
Returns a slice of this buffer's sub-region.
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
alloc, array, arrayOffset, asByteBuf, capacity, capacity, copy, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, getDoubleLE, getFloatLE, hasArray, hasMemoryAddress, internalNioBuffer, isContiguous, isDirect, maxFastWritableBytes, memoryAddress, nioBuffer, nioBufferCount, nioBuffers, order, readDoubleLE, readFloatLE, setBytes, setBytes, setBytes, setBytes, setBytes, setBytes, setDoubleLE, setFloatLE, unwrap, writeDoubleLE, writeFloatLE
Modifier and Type
Method
Description
abstract byte[]
Returns the backing byte array of this buffer.
abstract int
Returns the offset of the first byte within the backing byte array of
this buffer.
A ByteBuf can turn into itself.
abstract int
Returns the number of bytes (octets) this buffer can contain.
Adjusts the capacity of this buffer.
copy(int index,
int length)
Returns a copy of this buffer's sub-region.
getBytes(int index,
byte[] dst,
int dstIndex,
int length)
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.
Transfers this buffer's data to the specified stream starting at the
specified absolute index.
Transfers this buffer's data to the specified destination starting at
the specified absolute index until the destination's position
reaches its limit.
abstract int
Transfers this buffer's data starting at the specified absolute index
to the specified channel starting at the given file position.
abstract int
Transfers this buffer's data to the specified channel starting at the
specified absolute index.
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.
abstract boolean
Returns true if and only if this buffer has a backing byte array.
abstract boolean
Returns true if and only if this buffer has a reference to the low-level memory address that points
to the backing data.
Internal use only: Exposes the internal NIO buffer.
boolean
Returns true if this ByteBuf implementation is backed by a single memory region.
abstract boolean
Returns true if and only if this buffer is backed by an
NIO direct buffer.
int
Returns the maximum number of bytes which can be written for certain without involving
an internal reallocation or data-copy.
abstract long
Returns the low-level memory address that point to the first byte of ths backing data.
Exposes this buffer's sub-region as an NIO ByteBuffer.
abstract int
Returns the maximum number of NIO ByteBuffers that consist this buffer.
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.
use the Little Endian accessors, e.g.
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.
setBytes(int index,
byte[] src,
int srcIndex,
int length)
Transfers the specified source array's data to this buffer starting at
the specified absolute index.
Transfers the specified source buffer's data to this buffer starting at
the specified absolute index.
abstract int
Transfers the content of the specified source stream 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's position
reaches its limit.
abstract int
Transfers the content of the specified source channel starting at the given file position
to this buffer starting at the specified absolute index.
abstract int
Transfers the content of the specified source channel to this buffer
starting at the specified absolute index.
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.
Return the underlying buffer instance if this buffer is a wrapper of another buffer.
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
-
AbstractReferenceCountedByteBuf
protected AbstractReferenceCountedByteBuf(int maxCapacity)
-
Method Details
-
refCnt
public int refCnt()
Returns the reference count of this object. If 0, it means this object has been deallocated.
-
setRefCnt
protected final void setRefCnt(int refCnt)
An unsafe operation intended for use by a subclass that sets the reference count of the buffer directly
-
resetRefCnt
protected final void resetRefCnt()
An unsafe operation intended for use by a subclass that resets the reference count of the buffer to 1
-
-
-
touch
Records the current access location of this object for debugging purposes.
If this object is determined to be leaked, the information recorded by this operation will be provided to you
via ResourceLeakDetector. This method is a shortcut to touch(null).
- Specified by:
touch in interface ReferenceCounted
- Specified by:
touch in class ByteBuf
-
touch
Records the current access location of this object with an additional arbitrary information for debugging
purposes. If this object is determined to be leaked, the information recorded by this operation will be
provided to you via ResourceLeakDetector.
- Specified by:
touch in interface ReferenceCounted
- Specified by:
touch in class ByteBuf
-
release
public boolean release()
Decreases the reference count by 1 and deallocates this object if the reference count reaches at
0.
- Returns:
true if and only if the reference count became 0 and this object has been deallocated
-
release
public boolean release(int decrement)
Decreases the reference count by the specified decrement and deallocates this object if the reference
count reaches at 0.
- Returns:
true if and only if the reference count became 0 and this object has been deallocated
-
deallocate
protected abstract void deallocate()
|