Class UnpooledUnsafeHeapByteBuf
java.lang.Object
io.netty.buffer.ByteBuf
io.netty.buffer.AbstractByteBuf
io.netty.buffer.AbstractReferenceCountedByteBuf
io.netty.buffer.UnpooledHeapByteBuf
io.netty.buffer.UnpooledUnsafeHeapByteBuf
- All Implemented Interfaces:
ByteBufConvertible, ReferenceCounted, Comparable<ByteBuf>
Big endian Java heap buffer implementation. It is recommended to use
AbstractByteBufAllocator.heapBuffer(int, int), Unpooled.buffer(int) and
Unpooled.wrappedBuffer(byte[]) instead of calling the constructor explicitly.-
Constructor Summary
ConstructorsConstructorDescriptionUnpooledUnsafeHeapByteBuf(ByteBufAllocator alloc, int initialCapacity, int maxCapacity) Creates a new heap buffer with a newly allocated byte array. -
Method Summary
Modifier and TypeMethodDescriptionprotected byte_getByte(int index) protected int_getInt(int index) protected int_getIntLE(int index) protected long_getLong(int index) protected long_getLongLE(int index) protected short_getShort(int index) protected short_getShortLE(int index) protected int_getUnsignedMedium(int index) protected int_getUnsignedMediumLE(int index) protected void_setByte(int index, int value) protected void_setInt(int index, int value) protected void_setIntLE(int index, int value) protected void_setLong(int index, long value) protected void_setLongLE(int index, long value) protected void_setMedium(int index, int value) protected void_setMediumLE(int index, int value) protected void_setShort(int index, int value) protected void_setShortLE(int index, int value) protected byte[]allocateArray(int initialCapacity) bytegetByte(int index) Gets a byte at the specified absoluteindexin this buffer.intgetInt(int index) Gets a 32-bit integer at the specified absoluteindexin this buffer.intgetIntLE(int index) Gets a 32-bit integer at the specified absoluteindexin this buffer with Little Endian Byte Order.longgetLong(int index) Gets a 64-bit long integer at the specified absoluteindexin this buffer.longgetLongLE(int index) Gets a 64-bit long integer at the specified absoluteindexin this buffer in Little Endian Byte Order.shortgetShort(int index) Gets a 16-bit short integer at the specified absoluteindexin this buffer.shortgetShortLE(int index) Gets a 16-bit short integer at the specified absoluteindexin this buffer in Little Endian Byte Order.intgetUnsignedMedium(int index) Gets an unsigned 24-bit medium integer at the specified absoluteindexin this buffer.intgetUnsignedMediumLE(int index) Gets an unsigned 24-bit medium integer at the specified absoluteindexin this buffer in Little Endian Byte Order.protected SwappedByteBufDeprecated.setByte(int index, int value) Sets the specified byte at the specified absoluteindexin this buffer.setInt(int index, int value) Sets the specified 32-bit integer at the specified absoluteindexin this buffer.setIntLE(int index, int value) Sets the specified 32-bit integer at the specified absoluteindexin this buffer with Little Endian byte order .setLong(int index, long value) Sets the specified 64-bit long integer at the specified absoluteindexin this buffer.setLongLE(int index, long value) Sets the specified 64-bit long integer at the specified absoluteindexin this buffer in Little Endian Byte Order.setMedium(int index, int value) Sets the specified 24-bit medium integer at the specified absoluteindexin this buffer.setMediumLE(int index, int value) Sets the specified 24-bit medium integer at the specified absoluteindexin this buffer in the Little Endian Byte Order.setShort(int index, int value) Sets the specified 16-bit short integer at the specified absoluteindexin this buffer.setShortLE(int index, int value) Sets the specified 16-bit short integer at the specified absoluteindexin this buffer with the Little Endian Byte Order.setZero(int index, int length) Fills this buffer with NUL (0x00) starting at the specified absoluteindex.writeZero(int length) Fills this buffer with NUL (0x00) starting at the currentwriterIndexand increases thewriterIndexby the specifiedlength.Methods inherited from class UnpooledHeapByteBuf
alloc, array, arrayOffset, capacity, capacity, copy, deallocate, freeArray, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, hasArray, hasMemoryAddress, internalNioBuffer, isContiguous, isDirect, memoryAddress, nioBuffer, nioBufferCount, nioBuffers, order, readBytes, readBytes, setBytes, setBytes, setBytes, setBytes, setBytes, setBytes, unwrapModifier and TypeMethodDescriptionalloc()Returns theByteBufAllocatorwhich created this buffer.byte[]array()Returns the backing byte array of this buffer.intReturns the offset of the first byte within the backing byte array of this buffer.intcapacity()Returns the number of bytes (octets) this buffer can contain.capacity(int newCapacity) Adjusts the capacity of this buffer.copy(int index, int length) Returns a copy of this buffer's sub-region.protected voidCalled onceAbstractReferenceCountedByteBuf.refCnt()is equals 0.protected voidfreeArray(byte[] array) getBytes(int index, byte[] dst, int dstIndex, int length) Transfers this buffer's data to the specified destination starting at the specified absoluteindex.Transfers this buffer's data to the specified destination starting at the specified absoluteindex.getBytes(int index, OutputStream out, int length) Transfers this buffer's data to the specified stream starting at the specified absoluteindex.getBytes(int index, ByteBuffer dst) Transfers this buffer's data to the specified destination starting at the specified absoluteindexuntil the destination's position reaches its limit.intgetBytes(int index, FileChannel out, long position, int length) Transfers this buffer's data starting at the specified absoluteindexto the specified channel starting at the given file position.intgetBytes(int index, GatheringByteChannel out, int length) Transfers this buffer's data to the specified channel starting at the specified absoluteindex.booleanhasArray()Returnstrueif and only if this buffer has a backing byte array.booleanReturnstrueif and only if this buffer has a reference to the low-level memory address that points to the backing data.internalNioBuffer(int index, int length) Internal use only: Exposes the internal NIO buffer.final booleanReturnstrueif thisByteBufimplementation is backed by a single memory region.booleanisDirect()Returnstrueif and only if this buffer is backed by an NIO direct buffer.longReturns the low-level memory address that point to the first byte of ths backing data.nioBuffer(int index, int length) Exposes this buffer's sub-region as an NIOByteBuffer.intReturns the maximum number of NIOByteBuffers that consist this buffer.nioBuffers(int index, int length) Exposes this buffer's bytes as an NIOByteBuffer'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.order()Returns the endianness of this buffer.intreadBytes(FileChannel out, long position, int length) Transfers this buffer's data starting at the currentreaderIndexto the specified channel starting at the given file position.intreadBytes(GatheringByteChannel out, int length) Transfers this buffer's data to the specified stream starting at the currentreaderIndex.setBytes(int index, byte[] src, int srcIndex, int length) Transfers the specified source array's data to this buffer starting at the specified absoluteindex.Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex.intsetBytes(int index, InputStream in, int length) Transfers the content of the specified source stream to this buffer starting at the specified absoluteindex.setBytes(int index, ByteBuffer src) Transfers the specified source buffer's data to this buffer starting at the specified absoluteindexuntil the source buffer's position reaches its limit.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 absoluteindex.intsetBytes(int index, ScatteringByteChannel in, int length) Transfers the content of the specified source channel to this buffer starting at the specified absoluteindex.unwrap()Return the underlying buffer instance if this buffer is a wrapper of another buffer.Methods inherited from class AbstractReferenceCountedByteBuf
refCnt, release, release, resetRefCnt, retain, retain, setRefCnt, touch, touchModifier and TypeMethodDescriptionintrefCnt()Returns the reference count of this object.booleanrelease()Decreases the reference count by1and deallocates this object if the reference count reaches at0.booleanrelease(int decrement) Decreases the reference count by the specifieddecrementand deallocates this object if the reference count reaches at0.protected final voidAn unsafe operation intended for use by a subclass that resets the reference count of the buffer to 1retain()Increases the reference count by1.retain(int increment) Increases the reference count by the specifiedincrement.protected final voidsetRefCnt(int refCnt) An unsafe operation intended for use by a subclass that sets the reference count of the buffer directlytouch()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.Methods inherited from class AbstractByteBuf
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, getBytes, getBytes, getBytes, getChar, getCharSequence, getDouble, getFloat, getMedium, getMediumLE, getUnsignedByte, getUnsignedInt, getUnsignedIntLE, getUnsignedShort, getUnsignedShortLE, hashCode, indexOf, isReadable, isReadable, isReadOnly, isWritable, isWritable, markReaderIndex, markWriterIndex, maxCapacity, maxCapacity, maxWritableBytes, nioBuffer, nioBuffers, order, readableBytes, readBoolean, readByte, 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, 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, writeShortLEModifier and TypeMethodDescriptionprotected final voidadjustMarkers(int decrement) Returns a read-only version of this buffer.intbytesBefore(byte value) Locates the first occurrence of the specifiedvaluein this buffer.intbytesBefore(int length, byte value) Locates the first occurrence of the specifiedvaluein this buffer.intbytesBefore(int index, int length, byte value) Locates the first occurrence of the specifiedvaluein this buffer.protected final voidcheckDstIndex(int length, int dstIndex, int dstCapacity) protected final voidcheckDstIndex(int index, int length, int dstIndex, int dstCapacity) protected final voidcheckIndex(int index) protected final voidcheckIndex(int index, int fieldLength) protected final voidcheckNewCapacity(int newCapacity) protected final voidcheckReadableBytes(int minimumReadableBytes) Throws anIndexOutOfBoundsExceptionif the current readable bytes of this buffer is less than the specified value.protected final voidcheckSrcIndex(int index, int length, int srcIndex, int srcCapacity) clear()Sets thereaderIndexandwriterIndexof this buffer to0.intCompares the content of the specified buffer to the content of this buffer.copy()Returns a copy of this buffer's readable bytes.Discards the bytes between the 0th index andreaderIndex.Similar toByteBuf.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 voidShould be called by every method that tries to access the buffers content to check if the buffer was released before.ensureWritable(int minWritableBytes) Expands the bufferByteBuf.capacity()to make sure the number of writable bytes is equal to or greater than the specified value.intensureWritable(int minWritableBytes, boolean force) Expands the bufferByteBuf.capacity()to make sure the number of writable bytes is equal to or greater than the specified value.booleanDetermines if the content of the specified buffer is identical to the content of this array.intforEachByte(int index, int length, ByteProcessor processor) Iterates over the specified area of this buffer with the specifiedprocessorin ascending order.intforEachByte(ByteProcessor processor) Iterates over the readable bytes of this buffer with the specifiedprocessorin ascending order.intforEachByteDesc(int index, int length, ByteProcessor processor) Iterates over the specified area of this buffer with the specifiedprocessorin descending order.intforEachByteDesc(ByteProcessor processor) Iterates over the readable bytes of this buffer with the specifiedprocessorin descending order.booleangetBoolean(int index) Gets a boolean at the specified absolute (@code index) in this buffer.getBytes(int index, byte[] dst) Transfers this buffer's data to the specified destination starting at the specified absoluteindex.Transfers this buffer's data to the specified destination starting at the specified absoluteindexuntil the destination becomes non-writable.Transfers this buffer's data to the specified destination starting at the specified absoluteindex.chargetChar(int index) Gets a 2-byte UTF-16 character at the specified absoluteindexin this buffer.getCharSequence(int index, int length, Charset charset) Gets aCharSequencewith the given length at the given index.doublegetDouble(int index) Gets a 64-bit floating point number at the specified absoluteindexin this buffer.floatgetFloat(int index) Gets a 32-bit floating point number at the specified absoluteindexin this buffer.intgetMedium(int index) Gets a 24-bit medium integer at the specified absoluteindexin this buffer.intgetMediumLE(int index) Gets a 24-bit medium integer at the specified absoluteindexin this buffer in the Little Endian Byte Order.shortgetUnsignedByte(int index) Gets an unsigned byte at the specified absoluteindexin this buffer.longgetUnsignedInt(int index) Gets an unsigned 32-bit integer at the specified absoluteindexin this buffer.longgetUnsignedIntLE(int index) Gets an unsigned 32-bit integer at the specified absoluteindexin this buffer in Little Endian Byte Order.intgetUnsignedShort(int index) Gets an unsigned 16-bit short integer at the specified absoluteindexin this buffer.intgetUnsignedShortLE(int index) Gets an unsigned 16-bit short integer at the specified absoluteindexin this buffer in Little Endian Byte Order.inthashCode()Returns a hash code which was calculated from the content of this buffer.intindexOf(int fromIndex, int toIndex, byte value) Locates the first occurrence of the specifiedvaluein this buffer.booleanReturnstrueif and only if(this.writerIndex - this.readerIndex)is greater than0.booleanisReadable(int numBytes) Returnstrueif and only if this buffer contains equal to or more than the specified number of elements.booleanReturnstrueif and only if this buffer is read-only.booleanReturnstrueif and only if(this.capacity - this.writerIndex)is greater than0.booleanisWritable(int numBytes) Returnstrueif and only if this buffer has enough room to allow writing the specified number of elements.Marks the currentreaderIndexin this buffer.Marks the currentwriterIndexin this buffer.intReturns the maximum allowed capacity of this buffer.protected final voidmaxCapacity(int maxCapacity) intReturns the maximum possible number of writable bytes, which is equal to(this.maxCapacity - this.writerIndex).Exposes this buffer's readable bytes as an NIOByteBuffer.Exposes this buffer's readable bytes as an NIOByteBuffer's.Returns a buffer with the specifiedendiannesswhich shares the whole region, indexes, and marks of this buffer.intReturns the number of readable bytes which is equal to(this.writerIndex - this.readerIndex).booleanGets a boolean at the currentreaderIndexand increases thereaderIndexby1in this buffer.bytereadByte()Gets a byte at the currentreaderIndexand increases thereaderIndexby1in this buffer.readBytes(byte[] dst) Transfers this buffer's data to the specified destination starting at the currentreaderIndexand increases thereaderIndexby 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 currentreaderIndexand increases thereaderIndexby the number of the transferred bytes (=length).readBytes(int length) Transfers this buffer's data to a newly created buffer starting at the currentreaderIndexand increases thereaderIndexby the number of the transferred bytes (=length).Transfers this buffer's data to the specified destination starting at the currentreaderIndexuntil the destination becomes non-writable, and increases thereaderIndexby the number of the transferred bytes.Transfers this buffer's data to the specified destination starting at the currentreaderIndexand increases thereaderIndexby the number of the transferred bytes (=length).Transfers this buffer's data to the specified destination starting at the currentreaderIndexand increases thereaderIndexby the number of the transferred bytes (=length).readBytes(OutputStream out, int length) Transfers this buffer's data to the specified stream starting at the currentreaderIndex.readBytes(ByteBuffer dst) Transfers this buffer's data to the specified destination starting at the currentreaderIndexuntil the destination's position reaches its limit, and increases thereaderIndexby the number of the transferred bytes.charreadChar()Gets a 2-byte UTF-16 character at the currentreaderIndexand increases thereaderIndexby2in this buffer.readCharSequence(int length, Charset charset) Gets aCharSequencewith the given length at the currentreaderIndexand increases thereaderIndexby the given length.doubleGets a 64-bit floating point number at the currentreaderIndexand increases thereaderIndexby8in this buffer.intReturns thereaderIndexof this buffer.readerIndex(int readerIndex) Sets thereaderIndexof this buffer.floatGets a 32-bit floating point number at the currentreaderIndexand increases thereaderIndexby4in this buffer.intreadInt()Gets a 32-bit integer at the currentreaderIndexand increases thereaderIndexby4in this buffer.intGets a 32-bit integer at the currentreaderIndexin the Little Endian Byte Order and increases thereaderIndexby4in this buffer.longreadLong()Gets a 64-bit integer at the currentreaderIndexand increases thereaderIndexby8in this buffer.longGets a 64-bit integer at the currentreaderIndexin the Little Endian Byte Order and increases thereaderIndexby8in this buffer.intGets a 24-bit medium integer at the currentreaderIndexand increases thereaderIndexby3in this buffer.intGets a 24-bit medium integer at the currentreaderIndexin the Little Endian Byte Order and increases thereaderIndexby3in this buffer.readRetainedSlice(int length) Returns a new retained slice of this buffer's sub-region starting at the currentreaderIndexand increases thereaderIndexby the size of the new slice (=length).shortGets a 16-bit short integer at the currentreaderIndexand increases thereaderIndexby2in this buffer.shortGets a 16-bit short integer at the currentreaderIndexin the Little Endian Byte Order and increases thereaderIndexby2in this buffer.readSlice(int length) Returns a new slice of this buffer's sub-region starting at the currentreaderIndexand increases thereaderIndexby the size of the new slice (=length).shortGets an unsigned byte at the currentreaderIndexand increases thereaderIndexby1in this buffer.longGets an unsigned 32-bit integer at the currentreaderIndexand increases thereaderIndexby4in this buffer.longGets an unsigned 32-bit integer at the currentreaderIndexin the Little Endian Byte Order and increases thereaderIndexby4in this buffer.intGets an unsigned 24-bit medium integer at the currentreaderIndexand increases thereaderIndexby3in this buffer.intGets an unsigned 24-bit medium integer at the currentreaderIndexin the Little Endian Byte Order and increases thereaderIndexby3in this buffer.intGets an unsigned 16-bit short integer at the currentreaderIndexand increases thereaderIndexby2in this buffer.intGets an unsigned 16-bit short integer at the currentreaderIndexin the Little Endian Byte Order and increases thereaderIndexby2in this buffer.Repositions the currentreaderIndexto the markedreaderIndexin this buffer.Repositions the currentwriterIndexto the markedwriterIndexin this buffer.Returns a retained buffer which shares the whole region of this buffer.Returns a retained slice of this buffer's readable bytes.retainedSlice(int index, int length) Returns a retained slice of this buffer's sub-region.setBoolean(int index, boolean value) Sets the specified boolean at the specified absoluteindexin this buffer.setBytes(int index, byte[] src) Transfers the specified source array's data to this buffer starting at the specified absoluteindex.Transfers the specified source buffer's data to this buffer starting at the specified absoluteindexuntil the source buffer becomes unreadable.Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex.setChar(int index, int value) Sets the specified 2-byte UTF-16 character at the specified absoluteindexin this buffer.intsetCharSequence(int index, CharSequence sequence, Charset charset) Writes the specifiedCharSequenceat the givenindex.setDouble(int index, double value) Sets the specified 64-bit floating-point number at the specified absoluteindexin this buffer.setFloat(int index, float value) Sets the specified 32-bit floating-point number at the specified absoluteindexin this buffer.setIndex(int readerIndex, int writerIndex) Sets thereaderIndexandwriterIndexof this buffer in one shot.skipBytes(int length) Increases the currentreaderIndexby the specifiedlengthin this buffer.slice()Returns a slice of this buffer's readable bytes.slice(int index, int length) Returns a slice of this buffer's sub-region.toString()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 voidtrimIndicesToCapacity(int newCapacity) intReturns the number of writable bytes which is equal to(this.capacity - this.writerIndex).writeBoolean(boolean value) Sets the specified boolean at the currentwriterIndexand increases thewriterIndexby1in this buffer.writeByte(int value) Sets the specified byte at the currentwriterIndexand increases thewriterIndexby1in this buffer.writeBytes(byte[] src) Transfers the specified source array's data to this buffer starting at the currentwriterIndexand increases thewriterIndexby the number of the transferred bytes (=src.length).writeBytes(byte[] src, int srcIndex, int length) Transfers the specified source array's data to this buffer starting at the currentwriterIndexand increases thewriterIndexby the number of the transferred bytes (=length).writeBytes(ByteBuf src) Transfers the specified source buffer's data to this buffer starting at the currentwriterIndexuntil the source buffer becomes unreadable, and increases thewriterIndexby the number of the transferred bytes.writeBytes(ByteBuf src, int length) Transfers the specified source buffer's data to this buffer starting at the currentwriterIndexand increases thewriterIndexby the number of the transferred bytes (=length).writeBytes(ByteBuf src, int srcIndex, int length) Transfers the specified source buffer's data to this buffer starting at the currentwriterIndexand increases thewriterIndexby 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 currentwriterIndexand increases thewriterIndexby the number of the transferred bytes.writeBytes(ByteBuffer src) Transfers the specified source buffer's data to this buffer starting at the currentwriterIndexuntil the source buffer's position reaches its limit, and increases thewriterIndexby the number of the transferred bytes.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 currentwriterIndexand increases thewriterIndexby the number of the transferred bytes.intwriteBytes(ScatteringByteChannel in, int length) Transfers the content of the specified channel to this buffer starting at the currentwriterIndexand increases thewriterIndexby the number of the transferred bytes.writeChar(int value) Sets the specified 2-byte UTF-16 character at the currentwriterIndexand increases thewriterIndexby2in this buffer.intwriteCharSequence(CharSequence sequence, Charset charset) Writes the specifiedCharSequenceat the currentwriterIndexand increases thewriterIndexby the written bytes. in this buffer.writeDouble(double value) Sets the specified 64-bit floating point number at the currentwriterIndexand increases thewriterIndexby8in this buffer.writeFloat(float value) Sets the specified 32-bit floating point number at the currentwriterIndexand increases thewriterIndexby4in this buffer.writeInt(int value) Sets the specified 32-bit integer at the currentwriterIndexand increases thewriterIndexby4in this buffer.writeIntLE(int value) Sets the specified 32-bit integer at the currentwriterIndexin the Little Endian Byte Order and increases thewriterIndexby4in this buffer.writeLong(long value) Sets the specified 64-bit long integer at the currentwriterIndexand increases thewriterIndexby8in this buffer.writeLongLE(long value) Sets the specified 64-bit long integer at the currentwriterIndexin the Little Endian Byte Order and increases thewriterIndexby8in this buffer.writeMedium(int value) Sets the specified 24-bit medium integer at the currentwriterIndexand increases thewriterIndexby3in this buffer.writeMediumLE(int value) Sets the specified 24-bit medium integer at the currentwriterIndexin the Little Endian Byte Order and increases thewriterIndexby3in this buffer.intReturns thewriterIndexof this buffer.writerIndex(int writerIndex) Sets thewriterIndexof this buffer.writeShort(int value) Sets the specified 16-bit short integer at the currentwriterIndexand increases thewriterIndexby2in this buffer.writeShortLE(int value) Sets the specified 16-bit short integer in the Little Endian Byte Order at the currentwriterIndexand increases thewriterIndexby2in this buffer.Methods inherited from class ByteBuf
asByteBuf, getDoubleLE, getFloatLE, maxFastWritableBytes, readDoubleLE, readFloatLE, setDoubleLE, setFloatLE, writeDoubleLE, writeFloatLEModifier and TypeMethodDescriptionAByteBufcan turn into itself.doublegetDoubleLE(int index) Gets a 64-bit floating point number at the specified absoluteindexin this buffer in Little Endian Byte Order.floatgetFloatLE(int index) Gets a 32-bit floating point number at the specified absoluteindexin this buffer in Little Endian Byte Order.intReturns the maximum number of bytes which can be written for certain without involving an internal reallocation or data-copy.doubleGets a 64-bit floating point number at the currentreaderIndexin Little Endian Byte Order and increases thereaderIndexby8in this buffer.floatGets a 32-bit floating point number at the currentreaderIndexin Little Endian Byte Order and increases thereaderIndexby4in this buffer.setDoubleLE(int index, double value) Sets the specified 64-bit floating-point number at the specified absoluteindexin this buffer in Little Endian Byte Order.setFloatLE(int index, float value) Sets the specified 32-bit floating-point number at the specified absoluteindexin this buffer in Little Endian Byte Order.writeDoubleLE(double value) Sets the specified 64-bit floating point number at the currentwriterIndexin Little Endian Byte Order and increases thewriterIndexby8in this buffer.writeFloatLE(float value) Sets the specified 32-bit floating point number at the currentwriterIndexin Little Endian Byte Order and increases thewriterIndexby4in this buffer.
-
Constructor Details
-
UnpooledUnsafeHeapByteBuf
Creates a new heap buffer with a newly allocated byte array.- Parameters:
initialCapacity- the initial capacity of the underlying byte arraymaxCapacity- the max capacity of the underlying byte array
-
-
Method Details
-
allocateArray
protected byte[] allocateArray(int initialCapacity) - Overrides:
allocateArrayin classUnpooledHeapByteBuf
-
getByte
public byte getByte(int index) Description copied from class:ByteBufGets a byte at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
getBytein classUnpooledHeapByteBuf
-
_getByte
protected byte _getByte(int index) - Overrides:
_getBytein classUnpooledHeapByteBuf
-
getShort
public short getShort(int index) Description copied from class:ByteBufGets a 16-bit short integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
getShortin classUnpooledHeapByteBuf
-
_getShort
protected short _getShort(int index) - Overrides:
_getShortin classUnpooledHeapByteBuf
-
getShortLE
public short getShortLE(int index) Description copied from class:ByteBufGets a 16-bit short integer at the specified absoluteindexin this buffer in Little Endian Byte Order. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
getShortLEin classUnpooledHeapByteBuf
-
_getShortLE
protected short _getShortLE(int index) - Overrides:
_getShortLEin classUnpooledHeapByteBuf
-
getUnsignedMedium
public int getUnsignedMedium(int index) Description copied from class:ByteBufGets an unsigned 24-bit medium integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
getUnsignedMediumin classUnpooledHeapByteBuf
-
_getUnsignedMedium
protected int _getUnsignedMedium(int index) - Overrides:
_getUnsignedMediumin classUnpooledHeapByteBuf
-
getUnsignedMediumLE
public int getUnsignedMediumLE(int index) Description copied from class:ByteBufGets an unsigned 24-bit medium integer at the specified absoluteindexin this buffer in Little Endian Byte Order. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
getUnsignedMediumLEin classUnpooledHeapByteBuf
-
_getUnsignedMediumLE
protected int _getUnsignedMediumLE(int index) - Overrides:
_getUnsignedMediumLEin classUnpooledHeapByteBuf
-
getInt
public int getInt(int index) Description copied from class:ByteBufGets a 32-bit integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
getIntin classUnpooledHeapByteBuf
-
_getInt
protected int _getInt(int index) - Overrides:
_getIntin classUnpooledHeapByteBuf
-
getIntLE
public int getIntLE(int index) Description copied from class:ByteBufGets a 32-bit integer at the specified absoluteindexin this buffer with Little Endian Byte Order. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
getIntLEin classUnpooledHeapByteBuf
-
_getIntLE
protected int _getIntLE(int index) - Overrides:
_getIntLEin classUnpooledHeapByteBuf
-
getLong
public long getLong(int index) Description copied from class:ByteBufGets a 64-bit long integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
getLongin classUnpooledHeapByteBuf
-
_getLong
protected long _getLong(int index) - Overrides:
_getLongin classUnpooledHeapByteBuf
-
getLongLE
public long getLongLE(int index) Description copied from class:ByteBufGets a 64-bit long integer at the specified absoluteindexin this buffer in Little Endian Byte Order. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
getLongLEin classUnpooledHeapByteBuf
-
_getLongLE
protected long _getLongLE(int index) - Overrides:
_getLongLEin classUnpooledHeapByteBuf
-
setByte
Description copied from class:ByteBufSets the specified byte at the specified absoluteindexin this buffer. The 24 high-order bits of the specified value are ignored. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
setBytein classUnpooledHeapByteBuf
-
_setByte
protected void _setByte(int index, int value) - Overrides:
_setBytein classUnpooledHeapByteBuf
-
setShort
Description copied from class:ByteBufSets the specified 16-bit short integer at the specified absoluteindexin this buffer. The 16 high-order bits of the specified value are ignored. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
setShortin classUnpooledHeapByteBuf
-
_setShort
protected void _setShort(int index, int value) - Overrides:
_setShortin classUnpooledHeapByteBuf
-
setShortLE
Description copied from class:ByteBufSets the specified 16-bit short integer at the specified absoluteindexin this buffer with the Little Endian Byte Order. The 16 high-order bits of the specified value are ignored. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
setShortLEin classUnpooledHeapByteBuf
-
_setShortLE
protected void _setShortLE(int index, int value) - Overrides:
_setShortLEin classUnpooledHeapByteBuf
-
setMedium
Description copied from class:ByteBufSets the specified 24-bit medium integer at the specified absoluteindexin this buffer. Please note that the most significant byte is ignored in the specified value. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
setMediumin classUnpooledHeapByteBuf
-
_setMedium
protected void _setMedium(int index, int value) - Overrides:
_setMediumin classUnpooledHeapByteBuf
-
setMediumLE
Description copied from class:ByteBufSets the specified 24-bit medium integer at the specified absoluteindexin 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 modifyreaderIndexorwriterIndexof this buffer.- Overrides:
setMediumLEin classUnpooledHeapByteBuf
-
_setMediumLE
protected void _setMediumLE(int index, int value) - Overrides:
_setMediumLEin classUnpooledHeapByteBuf
-
setInt
Description copied from class:ByteBufSets the specified 32-bit integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
setIntin classUnpooledHeapByteBuf
-
_setInt
protected void _setInt(int index, int value) - Overrides:
_setIntin classUnpooledHeapByteBuf
-
setIntLE
Description copied from class:ByteBufSets the specified 32-bit integer at the specified absoluteindexin this buffer with Little Endian byte order . This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
setIntLEin classUnpooledHeapByteBuf
-
_setIntLE
protected void _setIntLE(int index, int value) - Overrides:
_setIntLEin classUnpooledHeapByteBuf
-
setLong
Description copied from class:ByteBufSets the specified 64-bit long integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
setLongin classUnpooledHeapByteBuf
-
_setLong
protected void _setLong(int index, long value) - Overrides:
_setLongin classUnpooledHeapByteBuf
-
setLongLE
Description copied from class:ByteBufSets the specified 64-bit long integer at the specified absoluteindexin this buffer in Little Endian Byte Order. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
setLongLEin classUnpooledHeapByteBuf
-
_setLongLE
protected void _setLongLE(int index, long value) - Overrides:
_setLongLEin classUnpooledHeapByteBuf
-
setZero
Description copied from class:ByteBufFills this buffer with NUL (0x00) starting at the specified absoluteindex. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
setZeroin classAbstractByteBuf- Parameters:
length- the number of NULs to write to the buffer
-
writeZero
Description copied from class:ByteBufFills this buffer with NUL (0x00) starting at the currentwriterIndexand increases thewriterIndexby the specifiedlength. Ifthis.writableBytesis less thanlength,ByteBuf.ensureWritable(int)will be called in an attempt to expand capacity to accommodate.- Overrides:
writeZeroin classAbstractByteBuf- Parameters:
length- the number of NULs to write to the buffer
-
newSwappedByteBuf
Deprecated.Description copied from class:AbstractByteBufCreates a newSwappedByteBuffor thisByteBufinstance.- Overrides:
newSwappedByteBufin classAbstractByteBuf
-