Java io.netty.buffer ByteBuf fields, constructors, methods, implement or subclass

Example usage for Java io.netty.buffer ByteBuf fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for io.netty.buffer ByteBuf.

The text is from its open source code.

Subclass

io.netty.buffer.ByteBuf has subclasses.
Click this link to see all its subclasses.

Implementation

io.netty.buffer.ByteBuf has the following implementations.
Click this link to see all its implementation.

Method

ByteBufAllocatoralloc()
Returns the ByteBufAllocator which created this buffer.
byte[]array()
Returns the backing byte array of this buffer.
intarrayOffset()
Returns the offset of the first byte within the backing byte array of this buffer.
ByteBufasReadOnly()
Returns a read-only version of this buffer.
intbytesBefore(byte value)
Locates the first occurrence of the specified value in this buffer.
intcapacity()
Returns the number of bytes (octets) this buffer can contain.
ByteBufcapacity(int newCapacity)
Adjusts the capacity of this buffer.
ByteBufclear()
Sets the readerIndex and writerIndex of this buffer to 0 .
intcompareTo(ByteBuf buffer)
Compares the content of the specified buffer to the content of this buffer.
ByteBufcopy()
Returns a copy of this buffer's readable bytes.
ByteBufcopy(int index, int length)
Returns a copy of this buffer's sub-region.
ByteBufdiscardReadBytes()
Discards the bytes between the 0th index and readerIndex .
ByteBufdiscardSomeReadBytes()
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.
ByteBufduplicate()
Returns a buffer which shares the whole region of this buffer.
ByteBufensureWritable(int minWritableBytes)
Expands the buffer #capacity() to make sure the number of #writableBytes() writable bytes is equal to or greater than the specified value.
intensureWritable(int minWritableBytes, boolean force)
Expands the buffer #capacity() to make sure the number of #writableBytes() writable bytes is equal to or greater than the specified value.
booleanequals(Object obj)
Determines if the content of the specified buffer is identical to the content of this array.
intforEachByte(ByteProcessor processor)
Iterates over the readable bytes of this buffer with the specified processor in ascending order.
intforEachByte(int index, int length, ByteProcessor processor)
Iterates over the specified area of this buffer with the specified processor in ascending order.
intforEachByteDesc(ByteProcessor processor)
Iterates over the readable bytes of this buffer with the specified processor in descending order.
booleangetBoolean(int index)
Gets a boolean at the specified absolute (@code index) in this buffer.
bytegetByte(int index)
Gets a byte at the specified absolute index in this buffer.
ByteBufgetBytes(int index, ByteBuf dst)
Transfers this buffer's data to the specified destination starting at the specified absolute index until the destination becomes non-writable.
ByteBufgetBytes(int index, byte[] dst)
Transfers this buffer's data to the specified destination starting at the specified absolute index .
ByteBufgetBytes(int index, ByteBuffer dst)
Transfers this buffer's data to the specified destination starting at the specified absolute index until the destination's position reaches its limit.
ByteBufgetBytes(int index, ByteBuf dst, int dstIndex, int length)
Transfers this buffer's data to the specified destination starting at the specified absolute index .
ByteBufgetBytes(int index, byte[] dst, int dstIndex, int length)
Transfers this buffer's data to the specified destination starting at the specified absolute index .
intgetBytes(int index, FileChannel out, long position, int length)
Transfers this buffer's data starting at the specified absolute index to the specified channel starting at the given file position.
ByteBufgetBytes(int index, ByteBuf dst, int length)
Transfers this buffer's data to the specified destination starting at the specified absolute index .
ByteBufgetBytes(int index, OutputStream out, int length)
Transfers this buffer's data to the specified stream starting at the specified absolute index .
intgetBytes(int index, GatheringByteChannel out, int length)
Transfers this buffer's data to the specified channel starting at the specified absolute index .
CharSequencegetCharSequence(int index, int length, Charset charset)
Gets a CharSequence with the given length at the given index.
doublegetDouble(int index)
Gets a 64-bit floating point number at the specified absolute index in this buffer.
floatgetFloat(int index)
Gets a 32-bit floating point number at the specified absolute index in this buffer.
intgetInt(int index)
Gets a 32-bit integer at the specified absolute index in this buffer.
intgetIntLE(int index)
Gets a 32-bit integer at the specified absolute index in this buffer with Little Endian Byte Order.
longgetLong(int index)
Gets a 64-bit long integer at the specified absolute index in this buffer.
intgetMedium(int index)
Gets a 24-bit medium integer at the specified absolute index in this buffer.
intgetMediumLE(int index)
Gets a 24-bit medium integer at the specified absolute index in this buffer in the Little Endian Byte Order.
shortgetShort(int index)
Gets a 16-bit short integer at the specified absolute index in this buffer.
shortgetShortLE(int index)
Gets a 16-bit short integer at the specified absolute index in this buffer in Little Endian Byte Order.
shortgetUnsignedByte(int index)
Gets an unsigned byte at the specified absolute index in this buffer.
longgetUnsignedInt(int index)
Gets an unsigned 32-bit integer at the specified absolute index in this buffer.
longgetUnsignedIntLE(int index)
Gets an unsigned 32-bit integer at the specified absolute index in this buffer in Little Endian Byte Order.
intgetUnsignedMedium(int index)
Gets an unsigned 24-bit medium integer at the specified absolute index in this buffer.
intgetUnsignedMediumLE(int index)
Gets an unsigned 24-bit medium integer at the specified absolute index in this buffer in Little Endian Byte Order.
intgetUnsignedShort(int index)
Gets an unsigned 16-bit short integer at the specified absolute index in this buffer.
intgetUnsignedShortLE(int index)
Gets an unsigned 16-bit short integer at the specified absolute index in this buffer in Little Endian Byte Order.
booleanhasArray()
Returns true if and only if this buffer has a backing byte array.
inthashCode()
Returns a hash code which was calculated from the content of this buffer.
booleanhasMemoryAddress()
Returns true if and only if this buffer has a reference to the low-level memory address that points to the backing data.
intindexOf(int fromIndex, int toIndex, byte value)
Locates the first occurrence of the specified value in this buffer.
ByteBufferinternalNioBuffer(int index, int length)
Internal use only: Exposes the internal NIO buffer.
booleanisDirect()
Returns true if and only if this buffer is backed by an NIO direct buffer.
booleanisReadable()
Returns true if and only if (this.writerIndex - this.readerIndex) is greater than 0 .
booleanisReadable(int size)
Returns true if and only if this buffer contains equal to or more than the specified number of elements.
booleanisWritable()
Returns true if and only if (this.capacity - this.writerIndex) is greater than 0 .
booleanisWritable(int size)
Returns true if and only if this buffer has enough room to allow writing the specified number of elements.
ByteBufmarkReaderIndex()
Marks the current readerIndex in this buffer.
ByteBufmarkWriterIndex()
Marks the current writerIndex in this buffer.
intmaxCapacity()
Returns the maximum allowed capacity of this buffer.
longmemoryAddress()
Returns the low-level memory address that point to the first byte of ths backing data.
ByteBuffernioBuffer()
Exposes this buffer's readable bytes as an NIO ByteBuffer .
ByteBuffernioBuffer(int index, int length)
Exposes this buffer's sub-region as an NIO ByteBuffer .
intnioBufferCount()
Returns the maximum number of NIO ByteBuffer s that consist this buffer.
ByteBuffer[]nioBuffers()
Exposes this buffer's readable bytes as an NIO ByteBuffer 's.
ByteBuffer[]nioBuffers(int index, int length)
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.
ByteBuforder(ByteOrder endianness)
Returns a buffer with the specified endianness which shares the whole region, indexes, and marks of this buffer.
ByteOrderorder()
Returns the endianness of this buffer.
intreadableBytes()
Returns the number of readable bytes which is equal to (this.writerIndex - this.readerIndex) .
booleanreadBoolean()
Gets a boolean at the current readerIndex and increases the readerIndex by 1 in this buffer.
bytereadByte()
Gets a byte at the current readerIndex and increases the readerIndex by 1 in this buffer.
ByteBufreadBytes(ByteBuf 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 ).
ByteBufreadBytes(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 ).
intreadBytes(FileChannel out, long position, int length)
Transfers this buffer's data starting at the current readerIndex to the specified channel starting at the given file position.
ByteBufreadBytes(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 ).
ByteBufreadBytes(ByteBuf 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.
ByteBufreadBytes(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 ).
ByteBufreadBytes(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.
ByteBufreadBytes(ByteBuf 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 ).
ByteBufreadBytes(OutputStream out, int length)
Transfers this buffer's data to the specified stream starting at the current readerIndex .
intreadBytes(GatheringByteChannel out, int length)
Transfers this buffer's data to the specified stream starting at the current readerIndex .
charreadChar()
Gets a 2-byte UTF-16 character at the current readerIndex and increases the readerIndex by 2 in this buffer.
CharSequencereadCharSequence(int length, Charset charset)
Gets a CharSequence with the given length at the current readerIndex and increases the readerIndex by the given length.
doublereadDouble()
Gets a 64-bit floating point number at the current readerIndex and increases the readerIndex by 8 in this buffer.
doublereadDoubleLE()
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.
intreaderIndex()
Returns the readerIndex of this buffer.
ByteBufreaderIndex(int readerIndex)
Sets the readerIndex of this buffer.
floatreadFloat()
Gets a 32-bit floating point number at the current readerIndex and increases the readerIndex by 4 in this buffer.
floatreadFloatLE()
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.
intreadInt()
Gets a 32-bit integer at the current readerIndex and increases the readerIndex by 4 in this buffer.
intreadIntLE()
Gets a 32-bit integer at the current readerIndex in the Little Endian Byte Order and increases the readerIndex by 4 in this buffer.
longreadLong()
Gets a 64-bit integer at the current readerIndex and increases the readerIndex by 8 in this buffer.
longreadLongLE()
Gets a 64-bit integer at the current readerIndex in the Little Endian Byte Order and increases the readerIndex by 8 in this buffer.
intreadMedium()
Gets a 24-bit medium integer at the current readerIndex and increases the readerIndex by 3 in this buffer.
intreadMediumLE()
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.
ByteBufreadRetainedSlice(int length)
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 ).
shortreadShort()
Gets a 16-bit short integer at the current readerIndex and increases the readerIndex by 2 in this buffer.
shortreadShortLE()
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.
ByteBufreadSlice(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 ).
shortreadUnsignedByte()
Gets an unsigned byte at the current readerIndex and increases the readerIndex by 1 in this buffer.
longreadUnsignedInt()
Gets an unsigned 32-bit integer at the current readerIndex and increases the readerIndex by 4 in this buffer.
longreadUnsignedIntLE()
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.
intreadUnsignedMedium()
Gets an unsigned 24-bit medium integer at the current readerIndex and increases the readerIndex by 3 in this buffer.
intreadUnsignedMediumLE()
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.
intreadUnsignedShort()
Gets an unsigned 16-bit short integer at the current readerIndex and increases the readerIndex by 2 in this buffer.
intreadUnsignedShortLE()
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.
intrefCnt()
Returns the reference count of this object.
booleanrelease()
Decreases the reference count by 1 and deallocates this object if the reference count reaches at 0 .
booleanrelease(int decrement)
Decreases the reference count by the specified decrement and deallocates this object if the reference count reaches at 0 .
ByteBufresetReaderIndex()
Repositions the current readerIndex to the marked readerIndex in this buffer.
ByteBufresetWriterIndex()
Repositions the current writerIndex to the marked writerIndex in this buffer.
ByteBufretain()
ByteBufretain(int increment)
ByteBufretainedDuplicate()
Returns a retained buffer which shares the whole region of this buffer.
ByteBufretainedSlice(int index, int length)
Returns a retained slice of this buffer's sub-region.
ByteBufretainedSlice()
Returns a retained slice of this buffer's readable bytes.
ByteBufsetBoolean(int index, boolean value)
Sets the specified boolean at the specified absolute index in this buffer.
ByteBufsetByte(int index, int value)
Sets the specified byte at the specified absolute index in this buffer.
ByteBufsetBytes(int index, ByteBuf src)
Transfers the specified source buffer's data to this buffer starting at the specified absolute index until the source buffer becomes unreadable.
ByteBufsetBytes(int index, byte[] src)
Transfers the specified source array's data to this buffer starting at the specified absolute index .
ByteBufsetBytes(int index, ByteBuffer src)
Transfers the specified source buffer's data to this buffer starting at the specified absolute index until the source buffer's position reaches its limit.
ByteBufsetBytes(int index, ByteBuf src, int srcIndex, int length)
Transfers the specified source buffer's data to this buffer starting at the specified absolute index .
ByteBufsetBytes(int index, byte[] src, int srcIndex, int length)
Transfers the specified source array's data to this buffer starting at the specified absolute index .
intsetBytes(int index, FileChannel in, long position, int length)
Transfers the content of the specified source channel starting at the given file position to this buffer starting at the specified absolute index .
ByteBufsetBytes(int index, ByteBuf src, int length)
Transfers the specified source buffer's data to this buffer starting at the specified absolute index .
intsetBytes(int index, InputStream in, int length)
Transfers the content of the specified source stream to this buffer starting at the specified absolute index .
intsetBytes(int index, ScatteringByteChannel in, int length)
Transfers the content of the specified source channel to this buffer starting at the specified absolute index .
ByteBufsetIndex(int readerIndex, int writerIndex)
Sets the readerIndex and writerIndex of this buffer in one shot.
ByteBufsetInt(int index, int value)
Sets the specified 32-bit integer at the specified absolute index in this buffer.
ByteBufsetLong(int index, long value)
Sets the specified 64-bit long integer at the specified absolute index in this buffer.
ByteBufsetMedium(int index, int value)
Sets the specified 24-bit medium integer at the specified absolute index in this buffer.
ByteBufsetShort(int index, int value)
Sets the specified 16-bit short integer at the specified absolute index in this buffer.
ByteBufsetShortLE(int index, int value)
Sets the specified 16-bit short integer at the specified absolute index in this buffer with the Little Endian Byte Order.
ByteBufskipBytes(int length)
Increases the current readerIndex by the specified length in this buffer.
ByteBufslice()
Returns a slice of this buffer's readable bytes.
ByteBufslice(int index, int length)
Returns a slice of this buffer's sub-region.
StringtoString(int index, int length, Charset charset)
Decodes this buffer's sub-region into a string with the specified character set.
StringtoString(Charset charset)
Decodes this buffer's readable bytes into a string with the specified character set name.
StringtoString()
Returns the string representation of this buffer.
ByteBuftouch()
ByteBufunwrap()
Return the underlying buffer instance if this buffer is a wrapper of another buffer.
intwritableBytes()
Returns the number of writable bytes which is equal to (this.capacity - this.writerIndex) .
ByteBufwriteBoolean(boolean value)
Sets the specified boolean at the current writerIndex and increases the writerIndex by 1 in this buffer.
ByteBufwriteByte(int value)
Sets the specified byte at the current writerIndex and increases the writerIndex by 1 in this buffer.
ByteBufwriteBytes(ByteBuf 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.
ByteBufwriteBytes(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 ).
ByteBufwriteBytes(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.
ByteBufwriteBytes(ByteBuf 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 ).
intwriteBytes(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.
intwriteBytes(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.
ByteBufwriteBytes(ByteBuf 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 ).
ByteBufwriteBytes(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 ).
intwriteBytes(FileChannel in, long position, int length)
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.
ByteBufwriteChar(int value)
Sets the specified 2-byte UTF-16 character at the current writerIndex and increases the writerIndex by 2 in this buffer.
intwriteCharSequence(CharSequence sequence, Charset charset)
Writes the specified CharSequence at the current writerIndex and increases the writerIndex by the written bytes.
ByteBufwriteDouble(double value)
Sets the specified 64-bit floating point number at the current writerIndex and increases the writerIndex by 8 in this buffer.
ByteBufwriteFloat(float value)
Sets the specified 32-bit floating point number at the current writerIndex and increases the writerIndex by 4 in this buffer.
ByteBufwriteInt(int value)
Sets the specified 32-bit integer at the current writerIndex and increases the writerIndex by 4 in this buffer.
ByteBufwriteIntLE(int value)
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.
ByteBufwriteLong(long value)
Sets the specified 64-bit long integer at the current writerIndex and increases the writerIndex by 8 in this buffer.
ByteBufwriteLongLE(long value)
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.
ByteBufwriteMedium(int value)
Sets the specified 24-bit medium integer at the current writerIndex and increases the writerIndex by 3 in this buffer.
intwriterIndex()
Returns the writerIndex of this buffer.
ByteBufwriterIndex(int writerIndex)
Sets the writerIndex of this buffer.
ByteBufwriteShort(int value)
Sets the specified 16-bit short integer at the current writerIndex and increases the writerIndex by 2 in this buffer.
ByteBufwriteShortLE(int value)
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.
ByteBufwriteZero(int length)
Fills this buffer with NUL (0x00) starting at the current writerIndex and increases the writerIndex by the specified length .