Class DrillBuf

java.lang.Object
io.netty.buffer.ByteBuf
io.netty.buffer.AbstractByteBuf
io.netty.buffer.DrillBuf
All Implemented Interfaces:
io.netty.buffer.ByteBufConvertible, io.netty.util.ReferenceCounted, AutoCloseable, Comparable<io.netty.buffer.ByteBuf>

public final class DrillBuf extends io.netty.buffer.AbstractByteBuf implements AutoCloseable
Drill data structure for accessing and manipulating data buffers. This class is integrated with the Drill memory management layer for quota enforcement and buffer sharing.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    The outcome of a Transfer.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Number of bytes in an int
    static final int
    Number of bytes in a long
    static final int
    Number of bytes in a short
  • Constructor Summary

    Constructors
    Constructor
    Description
    DrillBuf(AtomicInteger refCnt, AllocationManager.BufferLedger ledger, UnsafeDirectLittleEndian byteBuf, BufferManager manager, io.netty.buffer.ByteBufAllocator alloc, int offset, int length, boolean isEmpty)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected 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
     
    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
     
    io.netty.buffer.ByteBufAllocator
     
    byte[]
     
    int
     
    static String
    bufferState(io.netty.buffer.ByteBuf buf)
     
    int
     
    capacity(int newCapacity)
     
    void
     
    io.netty.buffer.ByteBuf
     
    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
    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
     
    int
    getUnsignedShort(int index)
     
    boolean
     
    int
     
    boolean
     
    internalNioBuffer(int index, int length)
     
    boolean
     
    long
     
     
    nioBuffer(int index, int length)
     
    int
     
     
    nioBuffers(int index, int length)
     
     
    io.netty.buffer.ByteBuf
    order(ByteOrder endianness)
     
    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+destIndex
    static void
    putInt(byte[] dest, int destIndex, int value)
    Copy an integer value to the dest+destIndex
    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
    static void
    putLong(byte[] dest, int destIndex, long value)
    Copy a long value to the dest+destIndex
    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
    static void
    putShort(byte[] dest, int destIndex, short value)
    Copy a short value to the dest+destIndex
    io.netty.buffer.ByteBuf
    readBytes(int length)
     
    io.netty.buffer.ByteBuf
    readSlice(int length)
     
    reallocIfNeeded(int size)
     
    int
     
    boolean
     
    boolean
    release(int decrement)
    Release the provided number of reference counts.
    io.netty.buffer.ByteBuf
     
    io.netty.buffer.ByteBuf
    retain(int increment)
     
    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(int index, int length)
     
    toHexString(int start, int length)
    Return the buffer's byte contents in the form of a hex dump.
     
    toString(int index, int length, Charset charset)
     
    toString(Charset charset)
     
    io.netty.buffer.ByteBuf
     
    io.netty.buffer.ByteBuf
    touch(Object hint)
     
     
    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
     
    void
     
    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

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • LONG_NUM_BYTES

      public static final int LONG_NUM_BYTES
      Number of bytes in a long
      See Also:
    • INT_NUM_BYTES

      public static final int INT_NUM_BYTES
      Number of bytes in an int
      See Also:
    • SHORT_NUM_BYTES

      public static final int SHORT_NUM_BYTES
      Number of bytes in a short
      See Also:
  • Constructor Details

  • Method Details

    • reallocIfNeeded

      public DrillBuf reallocIfNeeded(int size)
    • refCnt

      public int refCnt()
      Specified by:
      refCnt in interface io.netty.util.ReferenceCounted
    • addr

      public long addr()
    • retain

      public DrillBuf retain(BufferAllocator target)
      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

      public DrillBuf.TransferResult transferOwnership(BufferAllocator target)
      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

      public AllocationManager.BufferLedger getLedger()
      Visible only for memory allocation calculations.
      Returns:
      The AllocationManager.BufferLedger associated with this DrillBuf.
    • release

      public boolean release()
      Specified by:
      release in interface io.netty.util.ReferenceCounted
    • release

      public boolean release(int decrement)
      Release the provided number of reference counts.
      Specified by:
      release in interface io.netty.util.ReferenceCounted
    • capacity

      public int capacity()
      Specified by:
      capacity in class io.netty.buffer.ByteBuf
    • capacity

      public DrillBuf capacity(int newCapacity)
      Specified by:
      capacity in class io.netty.buffer.ByteBuf
    • alloc

      public io.netty.buffer.ByteBufAllocator alloc()
      Specified by:
      alloc in class io.netty.buffer.ByteBuf
    • order

      public ByteOrder order()
      Specified by:
      order in class io.netty.buffer.ByteBuf
    • order

      public io.netty.buffer.ByteBuf order(ByteOrder endianness)
      Overrides:
      order in class io.netty.buffer.AbstractByteBuf
    • unwrap

      public io.netty.buffer.ByteBuf unwrap()
      Specified by:
      unwrap in class io.netty.buffer.ByteBuf
    • isDirect

      public boolean isDirect()
      Specified by:
      isDirect in class io.netty.buffer.ByteBuf
    • readBytes

      public io.netty.buffer.ByteBuf readBytes(int length)
      Overrides:
      readBytes in class io.netty.buffer.AbstractByteBuf
    • readSlice

      public io.netty.buffer.ByteBuf readSlice(int length)
      Overrides:
      readSlice in class io.netty.buffer.AbstractByteBuf
    • copy

      public io.netty.buffer.ByteBuf copy()
      Overrides:
      copy in class io.netty.buffer.AbstractByteBuf
    • copy

      public io.netty.buffer.ByteBuf copy(int index, int length)
      Specified by:
      copy in class io.netty.buffer.ByteBuf
    • slice

      public io.netty.buffer.ByteBuf slice()
      Overrides:
      slice in class io.netty.buffer.AbstractByteBuf
    • bufferState

      public static String bufferState(io.netty.buffer.ByteBuf buf)
    • slice

      public DrillBuf slice(int index, int length)
      Overrides:
      slice in class io.netty.buffer.AbstractByteBuf
    • duplicate

      public DrillBuf duplicate()
      Overrides:
      duplicate in class io.netty.buffer.AbstractByteBuf
    • nioBufferCount

      public int nioBufferCount()
      Specified by:
      nioBufferCount in class io.netty.buffer.ByteBuf
    • nioBuffer

      public ByteBuffer nioBuffer()
      Overrides:
      nioBuffer in class io.netty.buffer.AbstractByteBuf
    • nioBuffer

      public ByteBuffer nioBuffer(int index, int length)
      Specified by:
      nioBuffer in class io.netty.buffer.ByteBuf
    • internalNioBuffer

      public ByteBuffer internalNioBuffer(int index, int length)
      Specified by:
      internalNioBuffer in class io.netty.buffer.ByteBuf
    • nioBuffers

      public ByteBuffer[] nioBuffers()
      Overrides:
      nioBuffers in class io.netty.buffer.AbstractByteBuf
    • nioBuffers

      public ByteBuffer[] nioBuffers(int index, int length)
      Specified by:
      nioBuffers in class io.netty.buffer.ByteBuf
    • hasArray

      public boolean hasArray()
      Specified by:
      hasArray in class io.netty.buffer.ByteBuf
    • array

      public byte[] array()
      Specified by:
      array in class io.netty.buffer.ByteBuf
    • arrayOffset

      public int arrayOffset()
      Specified by:
      arrayOffset in class io.netty.buffer.ByteBuf
    • hasMemoryAddress

      public boolean hasMemoryAddress()
      Specified by:
      hasMemoryAddress in class io.netty.buffer.ByteBuf
    • memoryAddress

      public long memoryAddress()
      Specified by:
      memoryAddress in class io.netty.buffer.ByteBuf
    • toString

      public String toString()
      Overrides:
      toString in class io.netty.buffer.AbstractByteBuf
    • toString

      public String toString(Charset charset)
      Overrides:
      toString in class io.netty.buffer.AbstractByteBuf
    • toString

      public String toString(int index, int length, Charset charset)
      Overrides:
      toString in class io.netty.buffer.AbstractByteBuf
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class io.netty.buffer.AbstractByteBuf
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class io.netty.buffer.AbstractByteBuf
    • retain

      public io.netty.buffer.ByteBuf retain(int increment)
      Specified by:
      retain in interface io.netty.util.ReferenceCounted
      Specified by:
      retain in class io.netty.buffer.ByteBuf
    • retain

      public io.netty.buffer.ByteBuf retain()
      Specified by:
      retain in interface io.netty.util.ReferenceCounted
      Specified by:
      retain in class io.netty.buffer.ByteBuf
    • touch

      public io.netty.buffer.ByteBuf touch()
      Specified by:
      touch in interface io.netty.util.ReferenceCounted
      Specified by:
      touch in class io.netty.buffer.ByteBuf
    • touch

      public io.netty.buffer.ByteBuf touch(Object hint)
      Specified by:
      touch in interface io.netty.util.ReferenceCounted
      Specified by:
      touch in class io.netty.buffer.ByteBuf
    • getLong

      public long getLong(int index)
      Overrides:
      getLong in class io.netty.buffer.AbstractByteBuf
    • getLongLE

      public long getLongLE(int index)
      Overrides:
      getLongLE in class io.netty.buffer.AbstractByteBuf
    • getFloat

      public float getFloat(int index)
      Overrides:
      getFloat in class io.netty.buffer.AbstractByteBuf
    • getDouble

      public double getDouble(int index)
      Overrides:
      getDouble in class io.netty.buffer.AbstractByteBuf
    • getChar

      public char getChar(int index)
      Overrides:
      getChar in class io.netty.buffer.AbstractByteBuf
    • getUnsignedInt

      public long getUnsignedInt(int index)
      Overrides:
      getUnsignedInt in class io.netty.buffer.AbstractByteBuf
    • getInt

      public int getInt(int index)
      Overrides:
      getInt in class io.netty.buffer.AbstractByteBuf
    • getIntLE

      public int getIntLE(int index)
      Overrides:
      getIntLE in class io.netty.buffer.AbstractByteBuf
    • getUnsignedShort

      public int getUnsignedShort(int index)
      Overrides:
      getUnsignedShort in class io.netty.buffer.AbstractByteBuf
    • getShort

      public short getShort(int index)
      Overrides:
      getShort in class io.netty.buffer.AbstractByteBuf
    • getShortLE

      public short getShortLE(int index)
      Overrides:
      getShortLE in class io.netty.buffer.AbstractByteBuf
    • getUnsignedMedium

      public int getUnsignedMedium(int index)
      Overrides:
      getUnsignedMedium in class io.netty.buffer.AbstractByteBuf
    • getUnsignedMediumLE

      public int getUnsignedMediumLE(int index)
      Overrides:
      getUnsignedMediumLE in class io.netty.buffer.AbstractByteBuf
    • setShort

      public io.netty.buffer.ByteBuf setShort(int index, int value)
      Overrides:
      setShort in class io.netty.buffer.AbstractByteBuf
    • setShortLE

      public io.netty.buffer.ByteBuf setShortLE(int index, int value)
      Overrides:
      setShortLE in class io.netty.buffer.AbstractByteBuf
    • setMedium

      public io.netty.buffer.ByteBuf setMedium(int index, int value)
      Overrides:
      setMedium in class io.netty.buffer.AbstractByteBuf
    • setMediumLE

      public io.netty.buffer.ByteBuf setMediumLE(int index, int value)
      Overrides:
      setMediumLE in class io.netty.buffer.AbstractByteBuf
    • setInt

      public io.netty.buffer.ByteBuf setInt(int index, int value)
      Overrides:
      setInt in class io.netty.buffer.AbstractByteBuf
    • setIntLE

      public io.netty.buffer.ByteBuf setIntLE(int index, int value)
      Overrides:
      setIntLE in class io.netty.buffer.AbstractByteBuf
    • setLong

      public io.netty.buffer.ByteBuf setLong(int index, long value)
      Overrides:
      setLong in class io.netty.buffer.AbstractByteBuf
    • setLongLE

      public io.netty.buffer.ByteBuf setLongLE(int index, long value)
      Overrides:
      setLongLE in class io.netty.buffer.AbstractByteBuf
    • setChar

      public io.netty.buffer.ByteBuf setChar(int index, int value)
      Overrides:
      setChar in class io.netty.buffer.AbstractByteBuf
    • setFloat

      public io.netty.buffer.ByteBuf setFloat(int index, float value)
      Overrides:
      setFloat in class io.netty.buffer.AbstractByteBuf
    • setDouble

      public io.netty.buffer.ByteBuf setDouble(int index, double value)
      Overrides:
      setDouble in class io.netty.buffer.AbstractByteBuf
    • writeShort

      public io.netty.buffer.ByteBuf writeShort(int value)
      Overrides:
      writeShort in class io.netty.buffer.AbstractByteBuf
    • writeInt

      public io.netty.buffer.ByteBuf writeInt(int value)
      Overrides:
      writeInt in class io.netty.buffer.AbstractByteBuf
    • writeLong

      public io.netty.buffer.ByteBuf writeLong(long value)
      Overrides:
      writeLong in class io.netty.buffer.AbstractByteBuf
    • writeChar

      public io.netty.buffer.ByteBuf writeChar(int value)
      Overrides:
      writeChar in class io.netty.buffer.AbstractByteBuf
    • writeFloat

      public io.netty.buffer.ByteBuf writeFloat(float value)
      Overrides:
      writeFloat in class io.netty.buffer.AbstractByteBuf
    • writeDouble

      public io.netty.buffer.ByteBuf writeDouble(double value)
      Overrides:
      writeDouble in class io.netty.buffer.AbstractByteBuf
    • getBytes

      public io.netty.buffer.ByteBuf getBytes(int index, byte[] dst, int dstIndex, int length)
      Specified by:
      getBytes in class io.netty.buffer.ByteBuf
    • getBytes

      public io.netty.buffer.ByteBuf getBytes(int index, ByteBuffer dst)
      Specified by:
      getBytes in class io.netty.buffer.ByteBuf
    • setByte

      public io.netty.buffer.ByteBuf setByte(int index, int value)
      Overrides:
      setByte in class io.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 class io.netty.buffer.AbstractByteBuf
    • _getShort

      protected short _getShort(int index)
      Specified by:
      _getShort in class io.netty.buffer.AbstractByteBuf
    • _getShortLE

      protected short _getShortLE(int index)
      Specified by:
      _getShortLE in class io.netty.buffer.AbstractByteBuf
    • _getInt

      protected int _getInt(int index)
      Specified by:
      _getInt in class io.netty.buffer.AbstractByteBuf
    • _getIntLE

      protected int _getIntLE(int index)
      Specified by:
      _getIntLE in class io.netty.buffer.AbstractByteBuf
    • _getLong

      protected long _getLong(int index)
      Specified by:
      _getLong in class io.netty.buffer.AbstractByteBuf
    • _getLongLE

      protected long _getLongLE(int index)
      Specified by:
      _getLongLE in class io.netty.buffer.AbstractByteBuf
    • _setByte

      protected void _setByte(int index, int value)
      Specified by:
      _setByte in class io.netty.buffer.AbstractByteBuf
    • _setShort

      protected void _setShort(int index, int value)
      Specified by:
      _setShort in class io.netty.buffer.AbstractByteBuf
    • _setShortLE

      protected void _setShortLE(int index, int value)
      Specified by:
      _setShortLE in class io.netty.buffer.AbstractByteBuf
    • _setMedium

      protected void _setMedium(int index, int value)
      Specified by:
      _setMedium in class io.netty.buffer.AbstractByteBuf
    • _setMediumLE

      protected void _setMediumLE(int index, int value)
      Specified by:
      _setMediumLE in class io.netty.buffer.AbstractByteBuf
    • _setInt

      protected void _setInt(int index, int value)
      Specified by:
      _setInt in class io.netty.buffer.AbstractByteBuf
    • _setIntLE

      protected void _setIntLE(int index, int value)
      Specified by:
      _setIntLE in class io.netty.buffer.AbstractByteBuf
    • _setLong

      protected void _setLong(int index, long value)
      Specified by:
      _setLong in class io.netty.buffer.AbstractByteBuf
    • _setLongLE

      protected void _setLongLE(int index, long value)
      Specified by:
      _setLongLE in class io.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 class io.netty.buffer.ByteBuf
    • getBytes

      public io.netty.buffer.ByteBuf getBytes(int index, OutputStream out, int length) throws IOException
      Specified by:
      getBytes in class io.netty.buffer.ByteBuf
      Throws:
      IOException
    • getBytes

      public int getBytes(int index, FileChannel out, long position, int length) throws IOException
      Specified by:
      getBytes in class io.netty.buffer.ByteBuf
      Throws:
      IOException
    • _getUnsignedMedium

      protected int _getUnsignedMedium(int index)
      Specified by:
      _getUnsignedMedium in class io.netty.buffer.AbstractByteBuf
    • _getUnsignedMediumLE

      protected int _getUnsignedMediumLE(int index)
      Specified by:
      _getUnsignedMediumLE in class io.netty.buffer.AbstractByteBuf
    • getBytes

      public int getBytes(int index, GatheringByteChannel out, int length) throws IOException
      Specified by:
      getBytes in class io.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 class io.netty.buffer.ByteBuf
    • setBytes

      public io.netty.buffer.ByteBuf setBytes(int index, ByteBuffer src, int srcIndex, int length)
    • setBytes

      public io.netty.buffer.ByteBuf setBytes(int index, byte[] src, int srcIndex, int length)
      Specified by:
      setBytes in class io.netty.buffer.ByteBuf
    • setBytes

      public io.netty.buffer.ByteBuf setBytes(int index, ByteBuffer src)
      Specified by:
      setBytes in class io.netty.buffer.ByteBuf
    • setBytes

      public int setBytes(int index, InputStream in, int length) throws IOException
      Specified by:
      setBytes in class io.netty.buffer.ByteBuf
      Throws:
      IOException
    • setBytes

      public int setBytes(int index, ScatteringByteChannel in, int length) throws IOException
      Specified by:
      setBytes in class io.netty.buffer.ByteBuf
      Throws:
      IOException
    • setBytes

      public int setBytes(int index, FileChannel in, long position, int length) throws IOException
      Specified by:
      setBytes in class io.netty.buffer.ByteBuf
      Throws:
      IOException
    • getByte

      public byte getByte(int index)
      Overrides:
      getByte in class io.netty.buffer.AbstractByteBuf
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • 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

      public String toHexString(int start, int length)
      Return the buffer's byte contents in the form of a hex dump.
      Parameters:
      start - the starting byte index
      length - 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

      public String toVerboseString()
    • print

      public void print(StringBuilder sb, int indent, BaseAllocator.Verbosity verbosity)
    • 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 read
      length - 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 array
      index - 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 array
      index - 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 array
      index - 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 array
      srcIndex - source index
      dest - destination byte array
      destIndex - 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 array
      srcIndex - source index
      dest - destination byte array
      destIndex - 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 array
      srcIndex - source index
      dest - destination byte array
      destIndex - 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 array
      destIndex - destination index
      value - 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 array
      destIndex - destination index
      value - 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 array
      destIndex - destination index
      value - a long value