Example usage for Java io.netty.buffer ByteBuf fields, constructors, methods, implement or subclass
The text is from its open source code.
ByteBufAllocator | alloc() Returns the ByteBufAllocator which created this buffer. |
byte[] | array() Returns the backing byte array of this buffer. |
int | arrayOffset() Returns the offset of the first byte within the backing byte array of this buffer. |
ByteBuf | asReadOnly() Returns a read-only version of this buffer. |
int | bytesBefore(byte value) Locates the first occurrence of the specified value in this buffer. |
int | capacity() Returns the number of bytes (octets) this buffer can contain. |
ByteBuf | capacity(int newCapacity) Adjusts the capacity of this buffer. |
ByteBuf | clear() Sets the readerIndex and writerIndex of this buffer to 0 . |
int | compareTo(ByteBuf buffer) Compares the content of the specified buffer to the content of this buffer. |
ByteBuf | copy() Returns a copy of this buffer's readable bytes. |
ByteBuf | copy(int index, int length) Returns a copy of this buffer's sub-region. |
ByteBuf | discardReadBytes() Discards the bytes between the 0th index and readerIndex . |
ByteBuf | discardSomeReadBytes() 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. |
ByteBuf | duplicate() Returns a buffer which shares the whole region of this buffer. |
ByteBuf | ensureWritable(int minWritableBytes) Expands the buffer #capacity() to make sure the number of #writableBytes() writable bytes is equal to or greater than the specified value. |
int | ensureWritable(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. |
boolean | equals(Object obj) Determines if the content of the specified buffer is identical to the content of this array. |
int | forEachByte(ByteProcessor processor) Iterates over the readable bytes of this buffer with the specified processor in ascending order. |
int | forEachByte(int index, int length, ByteProcessor processor) Iterates over the specified area of this buffer with the specified processor in ascending order. |
int | forEachByteDesc(ByteProcessor processor) Iterates over the readable bytes of this buffer with the specified processor in descending order. |
boolean | getBoolean(int index) Gets a boolean at the specified absolute (@code index) in this buffer. |
byte | getByte(int index) Gets a byte at the specified absolute index in this buffer. |
ByteBuf | getBytes(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. |
ByteBuf | getBytes(int index, byte[] dst) Transfers this buffer's data to the specified destination starting at the specified absolute index . |
ByteBuf | getBytes(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. |
ByteBuf | getBytes(int index, ByteBuf dst, int dstIndex, int length) Transfers this buffer's data to the specified destination starting at the specified absolute index . |
ByteBuf | getBytes(int index, byte[] dst, int dstIndex, int length) Transfers this buffer's data to the specified destination starting at the specified absolute index . |
int | getBytes(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. |
ByteBuf | getBytes(int index, ByteBuf dst, int length) Transfers this buffer's data to the specified destination starting at the specified absolute index . |
ByteBuf | getBytes(int index, OutputStream out, int length) Transfers this buffer's data to the specified stream starting at the specified absolute index . |
int | getBytes(int index, GatheringByteChannel out, int length) Transfers this buffer's data to the specified channel starting at the specified absolute index . |
CharSequence | getCharSequence(int index, int length, Charset charset) Gets a CharSequence with the given length at the given index. |
double | getDouble(int index) Gets a 64-bit floating point number at the specified absolute index in this buffer. |
float | getFloat(int index) Gets a 32-bit floating point number at the specified absolute index in this buffer. |
int | getInt(int index) Gets a 32-bit integer at the specified absolute index in this buffer. |
int | getIntLE(int index) Gets a 32-bit integer at the specified absolute index in this buffer with Little Endian Byte Order. |
long | getLong(int index) Gets a 64-bit long integer at the specified absolute index in this buffer. |
int | getMedium(int index) Gets a 24-bit medium integer at the specified absolute index in this buffer. |
int | getMediumLE(int index) Gets a 24-bit medium integer at the specified absolute index in this buffer in the Little Endian Byte Order. |
short | getShort(int index) Gets a 16-bit short integer at the specified absolute index in this buffer. |
short | getShortLE(int index) Gets a 16-bit short integer at the specified absolute index in this buffer in Little Endian Byte Order. |
short | getUnsignedByte(int index) Gets an unsigned byte at the specified absolute index in this buffer. |
long | getUnsignedInt(int index) Gets an unsigned 32-bit integer at the specified absolute index in this buffer. |
long | getUnsignedIntLE(int index) Gets an unsigned 32-bit integer at the specified absolute index in this buffer in Little Endian Byte Order. |
int | getUnsignedMedium(int index) Gets an unsigned 24-bit medium integer at the specified absolute index in this buffer. |
int | getUnsignedMediumLE(int index) Gets an unsigned 24-bit medium integer at the specified absolute index in this buffer in Little Endian Byte Order. |
int | getUnsignedShort(int index) Gets an unsigned 16-bit short integer at the specified absolute index in this buffer. |
int | getUnsignedShortLE(int index) Gets an unsigned 16-bit short integer at the specified absolute index in this buffer in Little Endian Byte Order. |
boolean | hasArray() Returns true if and only if this buffer has a backing byte array. |
int | hashCode() Returns a hash code which was calculated from the content of this buffer. |
boolean | hasMemoryAddress() Returns true if and only if this buffer has a reference to the low-level memory address that points to the backing data. |
int | indexOf(int fromIndex, int toIndex, byte value) Locates the first occurrence of the specified value in this buffer. |
ByteBuffer | internalNioBuffer(int index, int length) Internal use only: Exposes the internal NIO buffer. |
boolean | isDirect() Returns true if and only if this buffer is backed by an NIO direct buffer. |
boolean | isReadable() Returns true if and only if (this.writerIndex - this.readerIndex) is greater than 0 . |
boolean | isReadable(int size) Returns true if and only if this buffer contains equal to or more than the specified number of elements. |
boolean | isWritable() Returns true if and only if (this.capacity - this.writerIndex) is greater than 0 . |
boolean | isWritable(int size) Returns true if and only if this buffer has enough room to allow writing the specified number of elements. |
ByteBuf | markReaderIndex() Marks the current readerIndex in this buffer. |
ByteBuf | markWriterIndex() Marks the current writerIndex in this buffer. |
int | maxCapacity() Returns the maximum allowed capacity of this buffer. |
long | memoryAddress() Returns the low-level memory address that point to the first byte of ths backing data. |
ByteBuffer | nioBuffer() Exposes this buffer's readable bytes as an NIO ByteBuffer . |
ByteBuffer | nioBuffer(int index, int length) Exposes this buffer's sub-region as an NIO ByteBuffer . |
int | nioBufferCount() 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. |
ByteBuf | order(ByteOrder endianness) Returns a buffer with the specified endianness which shares the whole region, indexes, and marks of this buffer. |
ByteOrder | order() Returns the endianness of this buffer. |
int | readableBytes() Returns the number of readable bytes which is equal to (this.writerIndex - this.readerIndex) . |
boolean | readBoolean() Gets a boolean at the current readerIndex and increases the readerIndex by 1 in this buffer. |
byte | readByte() Gets a byte at the current readerIndex and increases the readerIndex by 1 in this buffer. |
ByteBuf | readBytes(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 ). |
ByteBuf | 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 ). |
int | readBytes(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. |
ByteBuf | readBytes(int length) Transfers this buffer's data to a newly created buffer starting at the current readerIndex and increases the readerIndex by the number of the transferred bytes (= length ). |
ByteBuf | readBytes(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. |
ByteBuf | readBytes(byte[] dst) Transfers this buffer's data to the specified destination starting at the current readerIndex and increases the readerIndex by the number of the transferred bytes (= dst.length ). |
ByteBuf | readBytes(ByteBuffer dst) Transfers this buffer's data to the specified destination starting at the current readerIndex until the destination's position reaches its limit, and increases the readerIndex by the number of the transferred bytes. |
ByteBuf | readBytes(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 ). |
ByteBuf | readBytes(OutputStream out, int length) Transfers this buffer's data to the specified stream starting at the current readerIndex . |
int | readBytes(GatheringByteChannel out, int length) Transfers this buffer's data to the specified stream starting at the current readerIndex . |
char | readChar() Gets a 2-byte UTF-16 character at the current readerIndex and increases the readerIndex by 2 in this buffer. |
CharSequence | readCharSequence(int length, Charset charset) Gets a CharSequence with the given length at the current readerIndex and increases the readerIndex by the given length. |
double | readDouble() Gets a 64-bit floating point number at the current readerIndex and increases the readerIndex by 8 in this buffer. |
double | readDoubleLE() 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. |
int | readerIndex() Returns the readerIndex of this buffer. |
ByteBuf | readerIndex(int readerIndex) Sets the readerIndex of this buffer. |
float | readFloat() Gets a 32-bit floating point number at the current readerIndex and increases the readerIndex by 4 in this buffer. |
float | readFloatLE() 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. |
int | readInt() Gets a 32-bit integer at the current readerIndex and increases the readerIndex by 4 in this buffer. |
int | readIntLE() 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 | readLong() Gets a 64-bit integer at the current readerIndex and increases the readerIndex by 8 in this buffer. |
long | readLongLE() 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 | readMedium() Gets a 24-bit medium integer at the current readerIndex and increases the readerIndex by 3 in this buffer. |
int | readMediumLE() 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. |
ByteBuf | readRetainedSlice(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 ). |
short | readShort() Gets a 16-bit short integer at the current readerIndex and increases the readerIndex by 2 in this buffer. |
short | readShortLE() 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. |
ByteBuf | readSlice(int length) Returns a new slice of this buffer's sub-region starting at the current readerIndex and increases the readerIndex by the size of the new slice (= length ). |
short | readUnsignedByte() Gets an unsigned byte at the current readerIndex and increases the readerIndex by 1 in this buffer. |
long | readUnsignedInt() Gets an unsigned 32-bit integer at the current readerIndex and increases the readerIndex by 4 in this buffer. |
long | readUnsignedIntLE() 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 | readUnsignedMedium() Gets an unsigned 24-bit medium integer at the current readerIndex and increases the readerIndex by 3 in this buffer. |
int | readUnsignedMediumLE() 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 | readUnsignedShort() Gets an unsigned 16-bit short integer at the current readerIndex and increases the readerIndex by 2 in this buffer. |
int | readUnsignedShortLE() 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. |
int | refCnt() Returns the reference count of this object. |
boolean | release() Decreases the reference count by 1 and deallocates this object if the reference count reaches at 0 . |
boolean | release(int decrement) Decreases the reference count by the specified decrement and deallocates this object if the reference count reaches at 0 . |
ByteBuf | resetReaderIndex() Repositions the current readerIndex to the marked readerIndex in this buffer. |
ByteBuf | resetWriterIndex() Repositions the current writerIndex to the marked writerIndex in this buffer. |
ByteBuf | retain() |
ByteBuf | retain(int increment) |
ByteBuf | retainedDuplicate() Returns a retained buffer which shares the whole region of this buffer. |
ByteBuf | retainedSlice(int index, int length) Returns a retained slice of this buffer's sub-region. |
ByteBuf | retainedSlice() Returns a retained slice of this buffer's readable bytes. |
ByteBuf | setBoolean(int index, boolean value) Sets the specified boolean at the specified absolute index in this buffer. |
ByteBuf | setByte(int index, int value) Sets the specified byte at the specified absolute index in this buffer. |
ByteBuf | setBytes(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. |
ByteBuf | setBytes(int index, byte[] src) Transfers the specified source array's data to this buffer starting at the specified absolute index . |
ByteBuf | setBytes(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. |
ByteBuf | setBytes(int index, ByteBuf src, int srcIndex, int length) Transfers the specified source buffer's data to this buffer starting at the specified absolute index . |
ByteBuf | 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 . |
int | setBytes(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 . |
ByteBuf | setBytes(int index, ByteBuf src, int length) Transfers the specified source buffer's data to this buffer starting at the specified absolute index . |
int | setBytes(int index, InputStream in, int length) Transfers the content of the specified source stream to this buffer starting at the specified absolute index . |
int | setBytes(int index, ScatteringByteChannel in, int length) Transfers the content of the specified source channel to this buffer starting at the specified absolute index . |
ByteBuf | setIndex(int readerIndex, int writerIndex) Sets the readerIndex and writerIndex of this buffer in one shot. |
ByteBuf | setInt(int index, int value) Sets the specified 32-bit integer at the specified absolute index in this buffer. |
ByteBuf | setLong(int index, long value) Sets the specified 64-bit long integer at the specified absolute index in this buffer. |
ByteBuf | setMedium(int index, int value) Sets the specified 24-bit medium integer at the specified absolute index in this buffer. |
ByteBuf | setShort(int index, int value) Sets the specified 16-bit short integer at the specified absolute index in this buffer. |
ByteBuf | setShortLE(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. |
ByteBuf | skipBytes(int length) Increases the current readerIndex by the specified length in this buffer. |
ByteBuf | slice() Returns a slice of this buffer's readable bytes. |
ByteBuf | slice(int index, int length) Returns a slice of this buffer's sub-region. |
String | toString(int index, int length, Charset charset) Decodes this buffer's sub-region into a string with the specified character set. |
String | toString(Charset charset) Decodes this buffer's readable bytes into a string with the specified character set name. |
String | toString() Returns the string representation of this buffer. |
ByteBuf | touch() |
ByteBuf | unwrap() Return the underlying buffer instance if this buffer is a wrapper of another buffer. |
int | writableBytes() Returns the number of writable bytes which is equal to (this.capacity - this.writerIndex) . |
ByteBuf | writeBoolean(boolean value) Sets the specified boolean at the current writerIndex and increases the writerIndex by 1 in this buffer. |
ByteBuf | writeByte(int value) Sets the specified byte at the current writerIndex and increases the writerIndex by 1 in this buffer. |
ByteBuf | writeBytes(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. |
ByteBuf | writeBytes(byte[] src) Transfers the specified source array's data to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes (= src.length ). |
ByteBuf | writeBytes(ByteBuffer src) Transfers the specified source buffer's data to this buffer starting at the current writerIndex until the source buffer's position reaches its limit, and increases the writerIndex by the number of the transferred bytes. |
ByteBuf | writeBytes(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 ). |
int | writeBytes(InputStream in, int length) Transfers the content of the specified stream to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes. |
int | writeBytes(ScatteringByteChannel in, int length) Transfers the content of the specified channel to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes. |
ByteBuf | writeBytes(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 ). |
ByteBuf | writeBytes(byte[] src, int srcIndex, int length) Transfers the specified source array's data to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes (= length ). |
int | writeBytes(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. |
ByteBuf | writeChar(int value) Sets the specified 2-byte UTF-16 character at the current writerIndex and increases the writerIndex by 2 in this buffer. |
int | writeCharSequence(CharSequence sequence, Charset charset) Writes the specified CharSequence at the current writerIndex and increases the writerIndex by the written bytes. |
ByteBuf | writeDouble(double value) Sets the specified 64-bit floating point number at the current writerIndex and increases the writerIndex by 8 in this buffer. |
ByteBuf | writeFloat(float value) Sets the specified 32-bit floating point number at the current writerIndex and increases the writerIndex by 4 in this buffer. |
ByteBuf | writeInt(int value) Sets the specified 32-bit integer at the current writerIndex and increases the writerIndex by 4 in this buffer. |
ByteBuf | writeIntLE(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. |
ByteBuf | writeLong(long value) Sets the specified 64-bit long integer at the current writerIndex and increases the writerIndex by 8 in this buffer. |
ByteBuf | writeLongLE(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. |
ByteBuf | writeMedium(int value) Sets the specified 24-bit medium integer at the current writerIndex and increases the writerIndex by 3 in this buffer. |
int | writerIndex() Returns the writerIndex of this buffer. |
ByteBuf | writerIndex(int writerIndex) Sets the writerIndex of this buffer. |
ByteBuf | writeShort(int value) Sets the specified 16-bit short integer at the current writerIndex and increases the writerIndex by 2 in this buffer. |
ByteBuf | writeShortLE(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. |
ByteBuf | writeZero(int length) Fills this buffer with NUL (0x00) starting at the current writerIndex and increases the writerIndex by the specified length . |