Class DrillBuf
- All Implemented Interfaces:
io.netty.buffer.ByteBufConvertible
,io.netty.util.ReferenceCounted
,AutoCloseable
,Comparable<io.netty.buffer.ByteBuf>
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Number of bytes in an intstatic final int
Number of bytes in a longstatic final int
Number of bytes in a short -
Constructor Summary
ConstructorDescriptionDrillBuf
(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) long
addr()
io.netty.buffer.ByteBufAllocator
alloc()
byte[]
array()
int
static String
bufferState
(io.netty.buffer.ByteBuf buf) int
capacity()
capacity
(int newCapacity) void
close()
io.netty.buffer.ByteBuf
copy()
io.netty.buffer.ByteBuf
copy
(int index, int length) boolean
int
Return that is Accounted for by this buffer (and its potentially shared siblings within the context of the associated allocator).byte
getByte
(int index) io.netty.buffer.ByteBuf
getBytes
(int index, byte[] dst, int dstIndex, int length) io.netty.buffer.ByteBuf
getBytes
(int index, io.netty.buffer.ByteBuf dst, int dstIndex, int length) io.netty.buffer.ByteBuf
getBytes
(int index, OutputStream out, int length) io.netty.buffer.ByteBuf
getBytes
(int index, ByteBuffer dst) int
getBytes
(int index, FileChannel out, long position, int length) int
getBytes
(int index, GatheringByteChannel out, int length) char
getChar
(int index) double
getDouble
(int index) float
getFloat
(int index) long
getId()
Get the integer id assigned to this DrillBuf for debugging purposes.static int
getInt
(byte[] data, int index) int
getInt
(int index) int
getIntLE
(int index) Visible only for memory allocation calculations.static long
getLong
(byte[] data, int index) long
getLong
(int index) long
getLongLE
(int index) int
Returns the possible memory consumed by this DrillBuf in the worse case scenario.static short
getShort
(byte[] data, int index) short
getShort
(int index) short
getShortLE
(int index) long
getUnsignedInt
(int index) int
getUnsignedMedium
(int index) int
getUnsignedMediumLE
(int index) int
getUnsignedShort
(int index) boolean
hasArray()
int
hashCode()
boolean
internalNioBuffer
(int index, int length) boolean
isDirect()
long
nioBuffer
(int index, int length) int
nioBuffers
(int index, int length) order()
io.netty.buffer.ByteBuf
void
print
(StringBuilder sb, int indent, BaseAllocator.Verbosity verbosity) static void
putInt
(byte[] src, int srcIndex, byte[] dest, int destIndex) Read an integer at position src+srcIndex and copy it to the dest+destIndexstatic void
putInt
(byte[] dest, int destIndex, int value) Copy an integer value to the dest+destIndexstatic void
putLong
(byte[] src, int srcIndex, byte[] dest, int destIndex) Read a long at position src+srcIndex and copy it to the dest+destIndexstatic void
putLong
(byte[] dest, int destIndex, long value) Copy a long value to the dest+destIndexstatic void
putShort
(byte[] src, int srcIndex, byte[] dest, int destIndex) Read a short at position src+srcIndex and copy it to the dest+destIndexstatic void
putShort
(byte[] dest, int destIndex, short value) Copy a short value to the dest+destIndexio.netty.buffer.ByteBuf
readBytes
(int length) io.netty.buffer.ByteBuf
readSlice
(int length) reallocIfNeeded
(int size) int
refCnt()
boolean
release()
boolean
release
(int decrement) Release the provided number of reference counts.io.netty.buffer.ByteBuf
retain()
io.netty.buffer.ByteBuf
retain
(int increment) retain
(BufferAllocator target) Create a new DrillBuf that is associated with an alternative allocator for the purposes of memory ownership and accounting.void
setByte
(int index, byte b) io.netty.buffer.ByteBuf
setByte
(int index, int value) io.netty.buffer.ByteBuf
setBytes
(int index, byte[] src, int srcIndex, int length) io.netty.buffer.ByteBuf
setBytes
(int index, io.netty.buffer.ByteBuf src, int srcIndex, int length) int
setBytes
(int index, InputStream in, int length) io.netty.buffer.ByteBuf
setBytes
(int index, ByteBuffer src) io.netty.buffer.ByteBuf
setBytes
(int index, ByteBuffer src, int srcIndex, int length) int
setBytes
(int index, FileChannel in, long position, int length) int
setBytes
(int index, ScatteringByteChannel in, int length) io.netty.buffer.ByteBuf
setChar
(int index, int value) io.netty.buffer.ByteBuf
setDouble
(int index, double value) io.netty.buffer.ByteBuf
setFloat
(int index, float value) io.netty.buffer.ByteBuf
setInt
(int index, int value) io.netty.buffer.ByteBuf
setIntLE
(int index, int value) io.netty.buffer.ByteBuf
setLong
(int index, long value) io.netty.buffer.ByteBuf
setLongLE
(int index, long value) io.netty.buffer.ByteBuf
setMedium
(int index, int value) io.netty.buffer.ByteBuf
setMediumLE
(int index, int value) io.netty.buffer.ByteBuf
setShort
(int index, int value) io.netty.buffer.ByteBuf
setShortLE
(int index, int value) io.netty.buffer.ByteBuf
slice()
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.ByteBuf
touch()
io.netty.buffer.ByteBuf
transferOwnership
(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.ByteBuf
unwrap()
void
writeByteUnsafe
(byte b) io.netty.buffer.ByteBuf
writeChar
(int value) io.netty.buffer.ByteBuf
writeDouble
(double value) io.netty.buffer.ByteBuf
writeFloat
(float value) io.netty.buffer.ByteBuf
writeInt
(int value) io.netty.buffer.ByteBuf
writeLong
(long value) io.netty.buffer.ByteBuf
writeShort
(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, writeZero
Methods 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:
refCnt
in 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.BufferLedger
associated with thisDrillBuf
.
-
release
public boolean release()- Specified by:
release
in interfaceio.netty.util.ReferenceCounted
-
release
public boolean release(int decrement) Release the provided number of reference counts.- Specified by:
release
in interfaceio.netty.util.ReferenceCounted
-
capacity
public int capacity()- Specified by:
capacity
in classio.netty.buffer.ByteBuf
-
capacity
- Specified by:
capacity
in classio.netty.buffer.ByteBuf
-
alloc
public io.netty.buffer.ByteBufAllocator alloc()- Specified by:
alloc
in classio.netty.buffer.ByteBuf
-
order
- Specified by:
order
in classio.netty.buffer.ByteBuf
-
order
- Overrides:
order
in classio.netty.buffer.AbstractByteBuf
-
unwrap
public io.netty.buffer.ByteBuf unwrap()- Specified by:
unwrap
in classio.netty.buffer.ByteBuf
-
isDirect
public boolean isDirect()- Specified by:
isDirect
in classio.netty.buffer.ByteBuf
-
readBytes
public io.netty.buffer.ByteBuf readBytes(int length) - Overrides:
readBytes
in classio.netty.buffer.AbstractByteBuf
-
readSlice
public io.netty.buffer.ByteBuf readSlice(int length) - Overrides:
readSlice
in classio.netty.buffer.AbstractByteBuf
-
copy
public io.netty.buffer.ByteBuf copy()- Overrides:
copy
in classio.netty.buffer.AbstractByteBuf
-
copy
public io.netty.buffer.ByteBuf copy(int index, int length) - Specified by:
copy
in classio.netty.buffer.ByteBuf
-
slice
public io.netty.buffer.ByteBuf slice()- Overrides:
slice
in classio.netty.buffer.AbstractByteBuf
-
bufferState
-
slice
- Overrides:
slice
in classio.netty.buffer.AbstractByteBuf
-
duplicate
- Overrides:
duplicate
in classio.netty.buffer.AbstractByteBuf
-
nioBufferCount
public int nioBufferCount()- Specified by:
nioBufferCount
in classio.netty.buffer.ByteBuf
-
nioBuffer
- Overrides:
nioBuffer
in classio.netty.buffer.AbstractByteBuf
-
nioBuffer
- Specified by:
nioBuffer
in classio.netty.buffer.ByteBuf
-
internalNioBuffer
- Specified by:
internalNioBuffer
in classio.netty.buffer.ByteBuf
-
nioBuffers
- Overrides:
nioBuffers
in classio.netty.buffer.AbstractByteBuf
-
nioBuffers
- Specified by:
nioBuffers
in classio.netty.buffer.ByteBuf
-
hasArray
public boolean hasArray()- Specified by:
hasArray
in classio.netty.buffer.ByteBuf
-
array
public byte[] array()- Specified by:
array
in classio.netty.buffer.ByteBuf
-
arrayOffset
public int arrayOffset()- Specified by:
arrayOffset
in classio.netty.buffer.ByteBuf
-
hasMemoryAddress
public boolean hasMemoryAddress()- Specified by:
hasMemoryAddress
in classio.netty.buffer.ByteBuf
-
memoryAddress
public long memoryAddress()- Specified by:
memoryAddress
in classio.netty.buffer.ByteBuf
-
toString
- Overrides:
toString
in classio.netty.buffer.AbstractByteBuf
-
toString
- Overrides:
toString
in classio.netty.buffer.AbstractByteBuf
-
toString
- Overrides:
toString
in classio.netty.buffer.AbstractByteBuf
-
hashCode
public int hashCode()- Overrides:
hashCode
in classio.netty.buffer.AbstractByteBuf
-
equals
- Overrides:
equals
in classio.netty.buffer.AbstractByteBuf
-
retain
public io.netty.buffer.ByteBuf retain(int increment) - Specified by:
retain
in interfaceio.netty.util.ReferenceCounted
- Specified by:
retain
in classio.netty.buffer.ByteBuf
-
retain
public io.netty.buffer.ByteBuf retain()- Specified by:
retain
in interfaceio.netty.util.ReferenceCounted
- Specified by:
retain
in classio.netty.buffer.ByteBuf
-
touch
public io.netty.buffer.ByteBuf touch()- Specified by:
touch
in interfaceio.netty.util.ReferenceCounted
- Specified by:
touch
in classio.netty.buffer.ByteBuf
-
touch
- Specified by:
touch
in interfaceio.netty.util.ReferenceCounted
- Specified by:
touch
in classio.netty.buffer.ByteBuf
-
getLong
public long getLong(int index) - Overrides:
getLong
in classio.netty.buffer.AbstractByteBuf
-
getLongLE
public long getLongLE(int index) - Overrides:
getLongLE
in classio.netty.buffer.AbstractByteBuf
-
getFloat
public float getFloat(int index) - Overrides:
getFloat
in classio.netty.buffer.AbstractByteBuf
-
getDouble
public double getDouble(int index) - Overrides:
getDouble
in classio.netty.buffer.AbstractByteBuf
-
getChar
public char getChar(int index) - Overrides:
getChar
in classio.netty.buffer.AbstractByteBuf
-
getUnsignedInt
public long getUnsignedInt(int index) - Overrides:
getUnsignedInt
in classio.netty.buffer.AbstractByteBuf
-
getInt
public int getInt(int index) - Overrides:
getInt
in classio.netty.buffer.AbstractByteBuf
-
getIntLE
public int getIntLE(int index) - Overrides:
getIntLE
in classio.netty.buffer.AbstractByteBuf
-
getUnsignedShort
public int getUnsignedShort(int index) - Overrides:
getUnsignedShort
in classio.netty.buffer.AbstractByteBuf
-
getShort
public short getShort(int index) - Overrides:
getShort
in classio.netty.buffer.AbstractByteBuf
-
getShortLE
public short getShortLE(int index) - Overrides:
getShortLE
in classio.netty.buffer.AbstractByteBuf
-
getUnsignedMedium
public int getUnsignedMedium(int index) - Overrides:
getUnsignedMedium
in classio.netty.buffer.AbstractByteBuf
-
getUnsignedMediumLE
public int getUnsignedMediumLE(int index) - Overrides:
getUnsignedMediumLE
in classio.netty.buffer.AbstractByteBuf
-
setShort
public io.netty.buffer.ByteBuf setShort(int index, int value) - Overrides:
setShort
in classio.netty.buffer.AbstractByteBuf
-
setShortLE
public io.netty.buffer.ByteBuf setShortLE(int index, int value) - Overrides:
setShortLE
in classio.netty.buffer.AbstractByteBuf
-
setMedium
public io.netty.buffer.ByteBuf setMedium(int index, int value) - Overrides:
setMedium
in classio.netty.buffer.AbstractByteBuf
-
setMediumLE
public io.netty.buffer.ByteBuf setMediumLE(int index, int value) - Overrides:
setMediumLE
in classio.netty.buffer.AbstractByteBuf
-
setInt
public io.netty.buffer.ByteBuf setInt(int index, int value) - Overrides:
setInt
in classio.netty.buffer.AbstractByteBuf
-
setIntLE
public io.netty.buffer.ByteBuf setIntLE(int index, int value) - Overrides:
setIntLE
in classio.netty.buffer.AbstractByteBuf
-
setLong
public io.netty.buffer.ByteBuf setLong(int index, long value) - Overrides:
setLong
in classio.netty.buffer.AbstractByteBuf
-
setLongLE
public io.netty.buffer.ByteBuf setLongLE(int index, long value) - Overrides:
setLongLE
in classio.netty.buffer.AbstractByteBuf
-
setChar
public io.netty.buffer.ByteBuf setChar(int index, int value) - Overrides:
setChar
in classio.netty.buffer.AbstractByteBuf
-
setFloat
public io.netty.buffer.ByteBuf setFloat(int index, float value) - Overrides:
setFloat
in classio.netty.buffer.AbstractByteBuf
-
setDouble
public io.netty.buffer.ByteBuf setDouble(int index, double value) - Overrides:
setDouble
in classio.netty.buffer.AbstractByteBuf
-
writeShort
public io.netty.buffer.ByteBuf writeShort(int value) - Overrides:
writeShort
in classio.netty.buffer.AbstractByteBuf
-
writeInt
public io.netty.buffer.ByteBuf writeInt(int value) - Overrides:
writeInt
in classio.netty.buffer.AbstractByteBuf
-
writeLong
public io.netty.buffer.ByteBuf writeLong(long value) - Overrides:
writeLong
in classio.netty.buffer.AbstractByteBuf
-
writeChar
public io.netty.buffer.ByteBuf writeChar(int value) - Overrides:
writeChar
in classio.netty.buffer.AbstractByteBuf
-
writeFloat
public io.netty.buffer.ByteBuf writeFloat(float value) - Overrides:
writeFloat
in classio.netty.buffer.AbstractByteBuf
-
writeDouble
public io.netty.buffer.ByteBuf writeDouble(double value) - Overrides:
writeDouble
in classio.netty.buffer.AbstractByteBuf
-
getBytes
public io.netty.buffer.ByteBuf getBytes(int index, byte[] dst, int dstIndex, int length) - Specified by:
getBytes
in classio.netty.buffer.ByteBuf
-
getBytes
- Specified by:
getBytes
in classio.netty.buffer.ByteBuf
-
setByte
public io.netty.buffer.ByteBuf setByte(int index, int value) - Overrides:
setByte
in 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:
_getByte
in classio.netty.buffer.AbstractByteBuf
-
_getShort
protected short _getShort(int index) - Specified by:
_getShort
in classio.netty.buffer.AbstractByteBuf
-
_getShortLE
protected short _getShortLE(int index) - Specified by:
_getShortLE
in classio.netty.buffer.AbstractByteBuf
-
_getInt
protected int _getInt(int index) - Specified by:
_getInt
in classio.netty.buffer.AbstractByteBuf
-
_getIntLE
protected int _getIntLE(int index) - Specified by:
_getIntLE
in classio.netty.buffer.AbstractByteBuf
-
_getLong
protected long _getLong(int index) - Specified by:
_getLong
in classio.netty.buffer.AbstractByteBuf
-
_getLongLE
protected long _getLongLE(int index) - Specified by:
_getLongLE
in classio.netty.buffer.AbstractByteBuf
-
_setByte
protected void _setByte(int index, int value) - Specified by:
_setByte
in classio.netty.buffer.AbstractByteBuf
-
_setShort
protected void _setShort(int index, int value) - Specified by:
_setShort
in classio.netty.buffer.AbstractByteBuf
-
_setShortLE
protected void _setShortLE(int index, int value) - Specified by:
_setShortLE
in classio.netty.buffer.AbstractByteBuf
-
_setMedium
protected void _setMedium(int index, int value) - Specified by:
_setMedium
in classio.netty.buffer.AbstractByteBuf
-
_setMediumLE
protected void _setMediumLE(int index, int value) - Specified by:
_setMediumLE
in classio.netty.buffer.AbstractByteBuf
-
_setInt
protected void _setInt(int index, int value) - Specified by:
_setInt
in classio.netty.buffer.AbstractByteBuf
-
_setIntLE
protected void _setIntLE(int index, int value) - Specified by:
_setIntLE
in classio.netty.buffer.AbstractByteBuf
-
_setLong
protected void _setLong(int index, long value) - Specified by:
_setLong
in classio.netty.buffer.AbstractByteBuf
-
_setLongLE
protected void _setLongLE(int index, long value) - Specified by:
_setLongLE
in classio.netty.buffer.AbstractByteBuf
-
getBytes
public io.netty.buffer.ByteBuf getBytes(int index, io.netty.buffer.ByteBuf dst, int dstIndex, int length) - Specified by:
getBytes
in classio.netty.buffer.ByteBuf
-
getBytes
- Specified by:
getBytes
in classio.netty.buffer.ByteBuf
- Throws:
IOException
-
getBytes
- Specified by:
getBytes
in classio.netty.buffer.ByteBuf
- Throws:
IOException
-
_getUnsignedMedium
protected int _getUnsignedMedium(int index) - Specified by:
_getUnsignedMedium
in classio.netty.buffer.AbstractByteBuf
-
_getUnsignedMediumLE
protected int _getUnsignedMediumLE(int index) - Specified by:
_getUnsignedMediumLE
in classio.netty.buffer.AbstractByteBuf
-
getBytes
- Specified by:
getBytes
in 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:
setBytes
in classio.netty.buffer.ByteBuf
-
setBytes
-
setBytes
public io.netty.buffer.ByteBuf setBytes(int index, byte[] src, int srcIndex, int length) - Specified by:
setBytes
in classio.netty.buffer.ByteBuf
-
setBytes
- Specified by:
setBytes
in classio.netty.buffer.ByteBuf
-
setBytes
- Specified by:
setBytes
in classio.netty.buffer.ByteBuf
- Throws:
IOException
-
setBytes
- Specified by:
setBytes
in classio.netty.buffer.ByteBuf
- Throws:
IOException
-
setBytes
- Specified by:
setBytes
in classio.netty.buffer.ByteBuf
- Throws:
IOException
-
getByte
public byte getByte(int index) - Overrides:
getByte
in classio.netty.buffer.AbstractByteBuf
-
close
public void close()- Specified by:
close
in 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
-