Class DrillBuf
- All Implemented Interfaces:
io.netty.buffer.ByteBufConvertible,io.netty.util.ReferenceCounted,AutoCloseable,Comparable<io.netty.buffer.ByteBuf>
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intNumber of bytes in an intstatic final intNumber of bytes in a longstatic final intNumber of bytes in a short -
Constructor Summary
ConstructorsConstructorDescriptionDrillBuf(AtomicInteger refCnt, AllocationManager.BufferLedger ledger, UnsafeDirectLittleEndian byteBuf, BufferManager manager, io.netty.buffer.ByteBufAllocator alloc, int offset, int length, boolean isEmpty) -
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) longaddr()io.netty.buffer.ByteBufAllocatoralloc()byte[]array()intstatic StringbufferState(io.netty.buffer.ByteBuf buf) intcapacity()capacity(int newCapacity) voidclose()io.netty.buffer.ByteBufcopy()io.netty.buffer.ByteBufcopy(int index, int length) booleanintReturn that is Accounted for by this buffer (and its potentially shared siblings within the context of the associated allocator).bytegetByte(int index) io.netty.buffer.ByteBufgetBytes(int index, byte[] dst, int dstIndex, int length) io.netty.buffer.ByteBufgetBytes(int index, io.netty.buffer.ByteBuf dst, int dstIndex, int length) io.netty.buffer.ByteBufgetBytes(int index, OutputStream out, int length) io.netty.buffer.ByteBufgetBytes(int index, ByteBuffer dst) intgetBytes(int index, FileChannel out, long position, int length) intgetBytes(int index, GatheringByteChannel out, int length) chargetChar(int index) doublegetDouble(int index) floatgetFloat(int index) longgetId()Get the integer id assigned to this DrillBuf for debugging purposes.static intgetInt(byte[] data, int index) intgetInt(int index) intgetIntLE(int index) Visible only for memory allocation calculations.static longgetLong(byte[] data, int index) longgetLong(int index) longgetLongLE(int index) intReturns the possible memory consumed by this DrillBuf in the worse case scenario.static shortgetShort(byte[] data, int index) shortgetShort(int index) shortgetShortLE(int index) longgetUnsignedInt(int index) intgetUnsignedMedium(int index) intgetUnsignedMediumLE(int index) intgetUnsignedShort(int index) booleanhasArray()inthashCode()booleaninternalNioBuffer(int index, int length) booleanisDirect()longnioBuffer(int index, int length) intnioBuffers(int index, int length) order()io.netty.buffer.ByteBufvoidprint(StringBuilder sb, int indent, BaseAllocator.Verbosity verbosity) static voidputInt(byte[] src, int srcIndex, byte[] dest, int destIndex) Read an integer at position src+srcIndex and copy it to the dest+destIndexstatic voidputInt(byte[] dest, int destIndex, int value) Copy an integer value to the dest+destIndexstatic voidputLong(byte[] src, int srcIndex, byte[] dest, int destIndex) Read a long at position src+srcIndex and copy it to the dest+destIndexstatic voidputLong(byte[] dest, int destIndex, long value) Copy a long value to the dest+destIndexstatic voidputShort(byte[] src, int srcIndex, byte[] dest, int destIndex) Read a short at position src+srcIndex and copy it to the dest+destIndexstatic voidputShort(byte[] dest, int destIndex, short value) Copy a short value to the dest+destIndexio.netty.buffer.ByteBufreadBytes(int length) io.netty.buffer.ByteBufreadSlice(int length) reallocIfNeeded(int size) intrefCnt()booleanrelease()booleanrelease(int decrement) Release the provided number of reference counts.io.netty.buffer.ByteBufretain()io.netty.buffer.ByteBufretain(int increment) retain(BufferAllocator target) Create a new DrillBuf that is associated with an alternative allocator for the purposes of memory ownership and accounting.voidsetByte(int index, byte b) io.netty.buffer.ByteBufsetByte(int index, int value) io.netty.buffer.ByteBufsetBytes(int index, byte[] src, int srcIndex, int length) io.netty.buffer.ByteBufsetBytes(int index, io.netty.buffer.ByteBuf src, int srcIndex, int length) intsetBytes(int index, InputStream in, int length) io.netty.buffer.ByteBufsetBytes(int index, ByteBuffer src) io.netty.buffer.ByteBufsetBytes(int index, ByteBuffer src, int srcIndex, int length) intsetBytes(int index, FileChannel in, long position, int length) intsetBytes(int index, ScatteringByteChannel in, int length) io.netty.buffer.ByteBufsetChar(int index, int value) io.netty.buffer.ByteBufsetDouble(int index, double value) io.netty.buffer.ByteBufsetFloat(int index, float value) io.netty.buffer.ByteBufsetInt(int index, int value) io.netty.buffer.ByteBufsetIntLE(int index, int value) io.netty.buffer.ByteBufsetLong(int index, long value) io.netty.buffer.ByteBufsetLongLE(int index, long value) io.netty.buffer.ByteBufsetMedium(int index, int value) io.netty.buffer.ByteBufsetMediumLE(int index, int value) io.netty.buffer.ByteBufsetShort(int index, int value) io.netty.buffer.ByteBufsetShortLE(int index, int value) io.netty.buffer.ByteBufslice()slice(int index, int length) toHexString(int start, int length) Return the buffer's byte contents in the form of a hex dump.toString()io.netty.buffer.ByteBuftouch()io.netty.buffer.ByteBuftransferOwnership(BufferAllocator target) Transfer the memory accounting ownership of this DrillBuf to another allocator.byte[]unsafeGetMemory(int srcOffset, int length) Convenience method to read buffer bytes into a newly allocated byte array.io.netty.buffer.ByteBufunwrap()voidwriteByteUnsafe(byte b) io.netty.buffer.ByteBufwriteChar(int value) io.netty.buffer.ByteBufwriteDouble(double value) io.netty.buffer.ByteBufwriteFloat(float value) io.netty.buffer.ByteBufwriteInt(int value) io.netty.buffer.ByteBufwriteLong(long value) io.netty.buffer.ByteBufwriteShort(int value) Methods inherited from class io.netty.buffer.AbstractByteBuf
adjustMarkers, asReadOnly, bytesBefore, bytesBefore, bytesBefore, checkDstIndex, checkDstIndex, checkIndex, checkIndex, checkNewCapacity, checkReadableBytes, checkSrcIndex, clear, compareTo, discardReadBytes, discardSomeReadBytes, ensureAccessible, ensureWritable, ensureWritable, forEachByte, forEachByte, forEachByteDesc, forEachByteDesc, getBoolean, getBytes, getBytes, getBytes, getCharSequence, getMedium, getMediumLE, getUnsignedByte, getUnsignedIntLE, getUnsignedShortLE, indexOf, isReadable, isReadable, isReadOnly, isWritable, isWritable, markReaderIndex, markWriterIndex, maxCapacity, maxCapacity, maxWritableBytes, newSwappedByteBuf, readableBytes, readBoolean, readByte, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readChar, readCharSequence, readDouble, readerIndex, readerIndex, readFloat, readInt, readIntLE, readLong, readLongLE, readMedium, readMediumLE, readRetainedSlice, readShort, readShortLE, readUnsignedByte, readUnsignedInt, readUnsignedIntLE, readUnsignedMedium, readUnsignedMediumLE, readUnsignedShort, readUnsignedShortLE, resetReaderIndex, resetWriterIndex, retainedDuplicate, retainedSlice, retainedSlice, setBoolean, setBytes, setBytes, setBytes, setCharSequence, setIndex, setZero, skipBytes, trimIndicesToCapacity, writableBytes, writeBoolean, writeByte, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeCharSequence, writeIntLE, writeLongLE, writeMedium, writeMediumLE, writerIndex, writerIndex, writeShortLE, writeZeroMethods inherited from class io.netty.buffer.ByteBuf
asByteBuf, getDoubleLE, getFloatLE, isContiguous, maxFastWritableBytes, readDoubleLE, readFloatLE, setDoubleLE, setFloatLE, writeDoubleLE, writeFloatLE
-
Field Details
-
LONG_NUM_BYTES
public static final int LONG_NUM_BYTESNumber of bytes in a long- See Also:
-
INT_NUM_BYTES
public static final int INT_NUM_BYTESNumber of bytes in an int- See Also:
-
SHORT_NUM_BYTES
public static final int SHORT_NUM_BYTESNumber of bytes in a short- See Also:
-
-
Constructor Details
-
DrillBuf
public DrillBuf(AtomicInteger refCnt, AllocationManager.BufferLedger ledger, UnsafeDirectLittleEndian byteBuf, BufferManager manager, io.netty.buffer.ByteBufAllocator alloc, int offset, int length, boolean isEmpty)
-
-
Method Details
-
reallocIfNeeded
-
refCnt
public int refCnt()- Specified by:
refCntin interfaceio.netty.util.ReferenceCounted
-
addr
public long addr() -
retain
Create a new DrillBuf that is associated with an alternative allocator for the purposes of memory ownership and accounting. This has no impact on the reference counting for the current DrillBuf except in the situation where the passed in Allocator is the same as the current buffer. This operation has no impact on the reference count of this DrillBuf. The newly created DrillBuf with either have a reference count of 1 (in the case that this is the first time this memory is being associated with the new allocator) or the current value of the reference count + 1 for the other AllocationManager/BufferLedger combination in the case that the provided allocator already had an association to this underlying memory.- Parameters:
target- The target allocator to create an association with.- Returns:
- A new DrillBuf which shares the same underlying memory as this DrillBuf.
-
transferOwnership
Transfer the memory accounting ownership of this DrillBuf to another allocator. This will generate a new DrillBuf that carries an association with the underlying memory of this DrillBuf. If this DrillBuf is connected to the owning BufferLedger of this memory, that memory ownership/accounting will be transferred to the target allocator. If this DrillBuf does not currently own the memory underlying it (and is only associated with it), this does not transfer any ownership to the newly created DrillBuf.This operation has no impact on the reference count of this DrillBuf. The newly created DrillBuf with either have a reference count of 1 (in the case that this is the first time this memory is being associated with the new allocator) or the current value of the reference count for the other AllocationManager/BufferLedger combination in the case that the provided allocator already had an association to this underlying memory.
Transfers will always succeed, even if that puts the other allocator into an overlimit situation. This is possible due to the fact that the original owning allocator may have allocated this memory out of a local reservation whereas the target allocator may need to allocate new memory from a parent or RootAllocator. This operation is done in a mostly-lockless but consistent manner. As such, the overlimit==true situation could occur slightly prematurely to an actual overlimit==true condition. This is simply conservative behavior which means we may return overlimit slightly sooner than is necessary.
- Parameters:
target- The allocator to transfer ownership to.- Returns:
- A new transfer result with the impact of the transfer (whether it was overlimit) as well as the newly created DrillBuf.
-
getLedger
Visible only for memory allocation calculations.- Returns:
- The
AllocationManager.BufferLedgerassociated with thisDrillBuf.
-
release
public boolean release()- Specified by:
releasein interfaceio.netty.util.ReferenceCounted
-
release
public boolean release(int decrement) Release the provided number of reference counts.- Specified by:
releasein interfaceio.netty.util.ReferenceCounted
-
capacity
public int capacity()- Specified by:
capacityin classio.netty.buffer.ByteBuf
-
capacity
- Specified by:
capacityin classio.netty.buffer.ByteBuf
-
alloc
public io.netty.buffer.ByteBufAllocator alloc()- Specified by:
allocin classio.netty.buffer.ByteBuf
-
order
- Specified by:
orderin classio.netty.buffer.ByteBuf
-
order
- Overrides:
orderin classio.netty.buffer.AbstractByteBuf
-
unwrap
public io.netty.buffer.ByteBuf unwrap()- Specified by:
unwrapin classio.netty.buffer.ByteBuf
-
isDirect
public boolean isDirect()- Specified by:
isDirectin classio.netty.buffer.ByteBuf
-
readBytes
public io.netty.buffer.ByteBuf readBytes(int length) - Overrides:
readBytesin classio.netty.buffer.AbstractByteBuf
-
readSlice
public io.netty.buffer.ByteBuf readSlice(int length) - Overrides:
readSlicein classio.netty.buffer.AbstractByteBuf
-
copy
public io.netty.buffer.ByteBuf copy()- Overrides:
copyin classio.netty.buffer.AbstractByteBuf
-
copy
public io.netty.buffer.ByteBuf copy(int index, int length) - Specified by:
copyin classio.netty.buffer.ByteBuf
-
slice
public io.netty.buffer.ByteBuf slice()- Overrides:
slicein classio.netty.buffer.AbstractByteBuf
-
bufferState
-
slice
- Overrides:
slicein classio.netty.buffer.AbstractByteBuf
-
duplicate
- Overrides:
duplicatein classio.netty.buffer.AbstractByteBuf
-
nioBufferCount
public int nioBufferCount()- Specified by:
nioBufferCountin classio.netty.buffer.ByteBuf
-
nioBuffer
- Overrides:
nioBufferin classio.netty.buffer.AbstractByteBuf
-
nioBuffer
- Specified by:
nioBufferin classio.netty.buffer.ByteBuf
-
internalNioBuffer
- Specified by:
internalNioBufferin classio.netty.buffer.ByteBuf
-
nioBuffers
- Overrides:
nioBuffersin classio.netty.buffer.AbstractByteBuf
-
nioBuffers
- Specified by:
nioBuffersin classio.netty.buffer.ByteBuf
-
hasArray
public boolean hasArray()- Specified by:
hasArrayin classio.netty.buffer.ByteBuf
-
array
public byte[] array()- Specified by:
arrayin classio.netty.buffer.ByteBuf
-
arrayOffset
public int arrayOffset()- Specified by:
arrayOffsetin classio.netty.buffer.ByteBuf
-
hasMemoryAddress
public boolean hasMemoryAddress()- Specified by:
hasMemoryAddressin classio.netty.buffer.ByteBuf
-
memoryAddress
public long memoryAddress()- Specified by:
memoryAddressin classio.netty.buffer.ByteBuf
-
toString
- Overrides:
toStringin classio.netty.buffer.AbstractByteBuf
-
toString
- Overrides:
toStringin classio.netty.buffer.AbstractByteBuf
-
toString
- Overrides:
toStringin classio.netty.buffer.AbstractByteBuf
-
hashCode
public int hashCode()- Overrides:
hashCodein classio.netty.buffer.AbstractByteBuf
-
equals
- Overrides:
equalsin classio.netty.buffer.AbstractByteBuf
-
retain
public io.netty.buffer.ByteBuf retain(int increment) - Specified by:
retainin interfaceio.netty.util.ReferenceCounted- Specified by:
retainin classio.netty.buffer.ByteBuf
-
retain
public io.netty.buffer.ByteBuf retain()- Specified by:
retainin interfaceio.netty.util.ReferenceCounted- Specified by:
retainin classio.netty.buffer.ByteBuf
-
touch
public io.netty.buffer.ByteBuf touch()- Specified by:
touchin interfaceio.netty.util.ReferenceCounted- Specified by:
touchin classio.netty.buffer.ByteBuf
-
touch
- Specified by:
touchin interfaceio.netty.util.ReferenceCounted- Specified by:
touchin classio.netty.buffer.ByteBuf
-
getLong
public long getLong(int index) - Overrides:
getLongin classio.netty.buffer.AbstractByteBuf
-
getLongLE
public long getLongLE(int index) - Overrides:
getLongLEin classio.netty.buffer.AbstractByteBuf
-
getFloat
public float getFloat(int index) - Overrides:
getFloatin classio.netty.buffer.AbstractByteBuf
-
getDouble
public double getDouble(int index) - Overrides:
getDoublein classio.netty.buffer.AbstractByteBuf
-
getChar
public char getChar(int index) - Overrides:
getCharin classio.netty.buffer.AbstractByteBuf
-
getUnsignedInt
public long getUnsignedInt(int index) - Overrides:
getUnsignedIntin classio.netty.buffer.AbstractByteBuf
-
getInt
public int getInt(int index) - Overrides:
getIntin classio.netty.buffer.AbstractByteBuf
-
getIntLE
public int getIntLE(int index) - Overrides:
getIntLEin classio.netty.buffer.AbstractByteBuf
-
getUnsignedShort
public int getUnsignedShort(int index) - Overrides:
getUnsignedShortin classio.netty.buffer.AbstractByteBuf
-
getShort
public short getShort(int index) - Overrides:
getShortin classio.netty.buffer.AbstractByteBuf
-
getShortLE
public short getShortLE(int index) - Overrides:
getShortLEin classio.netty.buffer.AbstractByteBuf
-
getUnsignedMedium
public int getUnsignedMedium(int index) - Overrides:
getUnsignedMediumin classio.netty.buffer.AbstractByteBuf
-
getUnsignedMediumLE
public int getUnsignedMediumLE(int index) - Overrides:
getUnsignedMediumLEin classio.netty.buffer.AbstractByteBuf
-
setShort
public io.netty.buffer.ByteBuf setShort(int index, int value) - Overrides:
setShortin classio.netty.buffer.AbstractByteBuf
-
setShortLE
public io.netty.buffer.ByteBuf setShortLE(int index, int value) - Overrides:
setShortLEin classio.netty.buffer.AbstractByteBuf
-
setMedium
public io.netty.buffer.ByteBuf setMedium(int index, int value) - Overrides:
setMediumin classio.netty.buffer.AbstractByteBuf
-
setMediumLE
public io.netty.buffer.ByteBuf setMediumLE(int index, int value) - Overrides:
setMediumLEin classio.netty.buffer.AbstractByteBuf
-
setInt
public io.netty.buffer.ByteBuf setInt(int index, int value) - Overrides:
setIntin classio.netty.buffer.AbstractByteBuf
-
setIntLE
public io.netty.buffer.ByteBuf setIntLE(int index, int value) - Overrides:
setIntLEin classio.netty.buffer.AbstractByteBuf
-
setLong
public io.netty.buffer.ByteBuf setLong(int index, long value) - Overrides:
setLongin classio.netty.buffer.AbstractByteBuf
-
setLongLE
public io.netty.buffer.ByteBuf setLongLE(int index, long value) - Overrides:
setLongLEin classio.netty.buffer.AbstractByteBuf
-
setChar
public io.netty.buffer.ByteBuf setChar(int index, int value) - Overrides:
setCharin classio.netty.buffer.AbstractByteBuf
-
setFloat
public io.netty.buffer.ByteBuf setFloat(int index, float value) - Overrides:
setFloatin classio.netty.buffer.AbstractByteBuf
-
setDouble
public io.netty.buffer.ByteBuf setDouble(int index, double value) - Overrides:
setDoublein classio.netty.buffer.AbstractByteBuf
-
writeShort
public io.netty.buffer.ByteBuf writeShort(int value) - Overrides:
writeShortin classio.netty.buffer.AbstractByteBuf
-
writeInt
public io.netty.buffer.ByteBuf writeInt(int value) - Overrides:
writeIntin classio.netty.buffer.AbstractByteBuf
-
writeLong
public io.netty.buffer.ByteBuf writeLong(long value) - Overrides:
writeLongin classio.netty.buffer.AbstractByteBuf
-
writeChar
public io.netty.buffer.ByteBuf writeChar(int value) - Overrides:
writeCharin classio.netty.buffer.AbstractByteBuf
-
writeFloat
public io.netty.buffer.ByteBuf writeFloat(float value) - Overrides:
writeFloatin classio.netty.buffer.AbstractByteBuf
-
writeDouble
public io.netty.buffer.ByteBuf writeDouble(double value) - Overrides:
writeDoublein classio.netty.buffer.AbstractByteBuf
-
getBytes
public io.netty.buffer.ByteBuf getBytes(int index, byte[] dst, int dstIndex, int length) - Specified by:
getBytesin classio.netty.buffer.ByteBuf
-
getBytes
- Specified by:
getBytesin classio.netty.buffer.ByteBuf
-
setByte
public io.netty.buffer.ByteBuf setByte(int index, int value) - Overrides:
setBytein classio.netty.buffer.AbstractByteBuf
-
setByte
public void setByte(int index, byte b) -
writeByteUnsafe
public void writeByteUnsafe(byte b) -
_getByte
protected byte _getByte(int index) - Specified by:
_getBytein classio.netty.buffer.AbstractByteBuf
-
_getShort
protected short _getShort(int index) - Specified by:
_getShortin classio.netty.buffer.AbstractByteBuf
-
_getShortLE
protected short _getShortLE(int index) - Specified by:
_getShortLEin classio.netty.buffer.AbstractByteBuf
-
_getInt
protected int _getInt(int index) - Specified by:
_getIntin classio.netty.buffer.AbstractByteBuf
-
_getIntLE
protected int _getIntLE(int index) - Specified by:
_getIntLEin classio.netty.buffer.AbstractByteBuf
-
_getLong
protected long _getLong(int index) - Specified by:
_getLongin classio.netty.buffer.AbstractByteBuf
-
_getLongLE
protected long _getLongLE(int index) - Specified by:
_getLongLEin classio.netty.buffer.AbstractByteBuf
-
_setByte
protected void _setByte(int index, int value) - Specified by:
_setBytein classio.netty.buffer.AbstractByteBuf
-
_setShort
protected void _setShort(int index, int value) - Specified by:
_setShortin classio.netty.buffer.AbstractByteBuf
-
_setShortLE
protected void _setShortLE(int index, int value) - Specified by:
_setShortLEin classio.netty.buffer.AbstractByteBuf
-
_setMedium
protected void _setMedium(int index, int value) - Specified by:
_setMediumin classio.netty.buffer.AbstractByteBuf
-
_setMediumLE
protected void _setMediumLE(int index, int value) - Specified by:
_setMediumLEin classio.netty.buffer.AbstractByteBuf
-
_setInt
protected void _setInt(int index, int value) - Specified by:
_setIntin classio.netty.buffer.AbstractByteBuf
-
_setIntLE
protected void _setIntLE(int index, int value) - Specified by:
_setIntLEin classio.netty.buffer.AbstractByteBuf
-
_setLong
protected void _setLong(int index, long value) - Specified by:
_setLongin classio.netty.buffer.AbstractByteBuf
-
_setLongLE
protected void _setLongLE(int index, long value) - Specified by:
_setLongLEin classio.netty.buffer.AbstractByteBuf
-
getBytes
public io.netty.buffer.ByteBuf getBytes(int index, io.netty.buffer.ByteBuf dst, int dstIndex, int length) - Specified by:
getBytesin classio.netty.buffer.ByteBuf
-
getBytes
- Specified by:
getBytesin classio.netty.buffer.ByteBuf- Throws:
IOException
-
getBytes
- Specified by:
getBytesin classio.netty.buffer.ByteBuf- Throws:
IOException
-
_getUnsignedMedium
protected int _getUnsignedMedium(int index) - Specified by:
_getUnsignedMediumin classio.netty.buffer.AbstractByteBuf
-
_getUnsignedMediumLE
protected int _getUnsignedMediumLE(int index) - Specified by:
_getUnsignedMediumLEin classio.netty.buffer.AbstractByteBuf
-
getBytes
- Specified by:
getBytesin classio.netty.buffer.ByteBuf- Throws:
IOException
-
setBytes
public io.netty.buffer.ByteBuf setBytes(int index, io.netty.buffer.ByteBuf src, int srcIndex, int length) - Specified by:
setBytesin classio.netty.buffer.ByteBuf
-
setBytes
-
setBytes
public io.netty.buffer.ByteBuf setBytes(int index, byte[] src, int srcIndex, int length) - Specified by:
setBytesin classio.netty.buffer.ByteBuf
-
setBytes
- Specified by:
setBytesin classio.netty.buffer.ByteBuf
-
setBytes
- Specified by:
setBytesin classio.netty.buffer.ByteBuf- Throws:
IOException
-
setBytes
- Specified by:
setBytesin classio.netty.buffer.ByteBuf- Throws:
IOException
-
setBytes
- Specified by:
setBytesin classio.netty.buffer.ByteBuf- Throws:
IOException
-
getByte
public byte getByte(int index) - Overrides:
getBytein classio.netty.buffer.AbstractByteBuf
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getPossibleMemoryConsumed
public int getPossibleMemoryConsumed()Returns the possible memory consumed by this DrillBuf in the worse case scenario. (not shared, connected to larger underlying buffer of allocated memory)- Returns:
- Size in bytes.
-
getActualMemoryConsumed
public int getActualMemoryConsumed()Return that is Accounted for by this buffer (and its potentially shared siblings within the context of the associated allocator).- Returns:
- Size in bytes.
-
toHexString
Return the buffer's byte contents in the form of a hex dump.- Parameters:
start- the starting byte indexlength- how many bytes to log- Returns:
- A hex dump in a String.
-
getId
public long getId()Get the integer id assigned to this DrillBuf for debugging purposes.- Returns:
- integer id
-
toVerboseString
-
print
-
unsafeGetMemory
public byte[] unsafeGetMemory(int srcOffset, int length) Convenience method to read buffer bytes into a newly allocated byte array.- Parameters:
srcOffset- the offset into this buffer of the data to readlength- number of bytes to read- Returns:
- byte array with the requested bytes
-
getShort
public static short getShort(byte[] data, int index) - Parameters:
data- source byte arrayindex- index within the byte array- Returns:
- short value starting at data+index
-
getInt
public static int getInt(byte[] data, int index) - Parameters:
data- source byte arrayindex- index within the byte array- Returns:
- integer value starting at data+index
-
getLong
public static long getLong(byte[] data, int index) - Parameters:
data- data source byte arrayindex- index within the byte array- Returns:
- long value read at data_index
-
putShort
public static void putShort(byte[] src, int srcIndex, byte[] dest, int destIndex) Read a short at position src+srcIndex and copy it to the dest+destIndex- Parameters:
src- source byte arraysrcIndex- source indexdest- destination byte arraydestIndex- destination index
-
putInt
public static void putInt(byte[] src, int srcIndex, byte[] dest, int destIndex) Read an integer at position src+srcIndex and copy it to the dest+destIndex- Parameters:
src- source byte arraysrcIndex- source indexdest- destination byte arraydestIndex- destination index
-
putLong
public static void putLong(byte[] src, int srcIndex, byte[] dest, int destIndex) Read a long at position src+srcIndex and copy it to the dest+destIndex- Parameters:
src- source byte arraysrcIndex- source indexdest- destination byte arraydestIndex- destination index
-
putShort
public static void putShort(byte[] dest, int destIndex, short value) Copy a short value to the dest+destIndex- Parameters:
dest- destination byte arraydestIndex- destination indexvalue- a short value
-
putInt
public static void putInt(byte[] dest, int destIndex, int value) Copy an integer value to the dest+destIndex- Parameters:
dest- destination byte arraydestIndex- destination indexvalue- an int value
-
putLong
public static void putLong(byte[] dest, int destIndex, long value) Copy a long value to the dest+destIndex- Parameters:
dest- destination byte arraydestIndex- destination indexvalue- a long value
-