Class DatabricksArrowBuf

  • All Implemented Interfaces:
    AutoCloseable

    public class DatabricksArrowBuf
    extends ArrowBuf
    A ByteBuffer-backed implementation of ArrowBuf that does not use unsafe memory operations. This implementation uses standard java.nio.ByteBuffer for all memory operations instead of MemoryUtil/Unsafe-based direct memory access.
    • Constructor Summary

      Constructors 
      Constructor Description
      DatabricksArrowBuf​(org.apache.arrow.memory.ReferenceManager referenceManager, org.apache.arrow.memory.BufferManager bufferManager, long capacity)
      Constructs a new DatabricksArrowBuf backed by a heap ByteBuffer.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      long capacity()  
      ArrowBuf capacity​(long newCapacity)
      Adjusts the capacity of this buffer.
      void checkBytes​(long start, long end)
      Allows a function to determine whether not reading a particular string of bytes is valid.
      ArrowBuf clear()  
      void close()  
      boolean equals​(Object obj)  
      long getActualMemoryConsumed()
      Return that is Accounted for by this buffer (and its potentially shared siblings within the context of the associated allocator).
      byte getByte​(long index)
      Get byte value stored at a particular index in the underlying memory chunk this ArrowBuf has access to.
      void getBytes​(long index, byte[] dst)
      Copy data from this ArrowBuf at a given index in into destination byte array.
      void getBytes​(long index, byte[] dst, int dstIndex, int length)
      Copy data from this ArrowBuf at a given index into destination byte array.
      void getBytes​(long index, OutputStream out, int length)
      Copy a certain length of bytes from this ArrowBuf at a given index into the given OutputStream.
      void getBytes​(long index, ByteBuffer dst)
      Copy data from this ArrowBuf at a given index into the destination ByteBuffer.
      void getBytes​(long index, ArrowBuf dst, long dstIndex, int length)
      Copy a given length of data from this ArrowBuf starting at a given index into a dst ArrowBuf at dstIndex.
      char getChar​(long index)
      Get char value stored at a particular index in the underlying memory chunk this ArrowBuf has access to.
      double getDouble​(long index)
      Get double value stored at a particular index in the underlying memory chunk this ArrowBuf has access to.
      float getFloat​(long index)
      Get float value stored at a particular index in the underlying memory chunk this ArrowBuf has access to.
      int getInt​(long index)
      Get int value stored at a particular index in the underlying memory chunk this ArrowBuf has access to.
      long getLong​(long index)
      Get long value stored at a particular index in the underlying memory chunk this ArrowBuf has access to.
      int getOffset()
      Returns the offset within the underlying ByteBuffer where this buffer's data starts.
      long getPossibleMemoryConsumed()
      Returns the possible memory consumed by this ArrowBuf in the worse case scenario.
      org.apache.arrow.memory.ReferenceManager getReferenceManager()
      Get reference manager for this ArrowBuf.
      short getShort​(long index)
      Get short value stored at a particular index in the underlying memory chunk this ArrowBuf has access to.
      int hashCode()  
      long memoryAddress()  
      ByteBuffer nioBuffer()
      Make a nio byte buffer from this arrowbuf.
      ByteBuffer nioBuffer​(long index, int length)
      Make a nio byte buffer from this ArrowBuf.
      ByteOrder order()
      Returns the byte order of elements in this buffer.
      void print​(StringBuilder sb, int indent)
      Print detailed information of this buffer into sb.
      long readableBytes()
      Returns the number of bytes still available to read in this buffer.
      byte readByte()
      Read the byte at readerIndex.
      void readBytes​(byte[] dst)
      Read dst.length bytes at readerIndex into dst byte array.
      long readerIndex()
      Get the index at which the next byte will be read from.
      ArrowBuf readerIndex​(long readerIndex)
      Set the reader index for this ArrowBuf.
      ArrowBuf reallocIfNeeded​(long size)
      Returns this if size is less than ArrowBuf.capacity(), otherwise delegates to BufferManager.replace(ArrowBuf, long) to get a new buffer.
      int refCnt()  
      void setByte​(long index, byte value)
      Set byte value at a particular index in the underlying memory chunk this ArrowBuf has access to.
      void setByte​(long index, int value)
      Set byte value at a particular index in the underlying memory chunk this ArrowBuf has access to.
      void setBytes​(long index, byte[] src)
      Copy data from a given byte array into this ArrowBuf starting at a given index.
      void setBytes​(long index, byte[] src, int srcIndex, long length)
      Copy data from a given byte array starting at the given source index into this ArrowBuf at a given index.
      int setBytes​(long index, InputStream in, int length)
      Copy a certain length of bytes from given InputStream into this ArrowBuf at the provided index.
      void setBytes​(long index, ByteBuffer src)
      Copy data into this ArrowBuf at a given index onwards from a source ByteBuffer.
      void setBytes​(long index, ByteBuffer src, int srcIndex, int length)
      Copy data into this ArrowBuf at a given index onwards from a source ByteBuffer starting at a given srcIndex for a certain length.
      void setBytes​(long index, ArrowBuf src)
      Copy readableBytes() number of bytes from src ArrowBuf starting from its readerIndex into this ArrowBuf starting at the given index.
      void setBytes​(long index, ArrowBuf src, long srcIndex, long length)
      Copy data from src ArrowBuf starting at index srcIndex into this ArrowBuf at given index.
      void setChar​(long index, int value)
      Set char value at a particular index in the underlying memory chunk this ArrowBuf has access to.
      void setDouble​(long index, double value)
      Set double value at a particular index in the underlying memory chunk this ArrowBuf has access to.
      void setFloat​(long index, float value)
      Set float value at a particular index in the underlying memory chunk this ArrowBuf has access to.
      void setInt​(long index, int value)
      Set int value at a particular index in the underlying memory chunk this ArrowBuf has access to.
      void setLong​(long index, long value)
      Set long value at a particular index in the underlying memory chunk this ArrowBuf has access to.
      ArrowBuf setOne​(int index, int length)
      Deprecated.
      ArrowBuf setOne​(long index, long length)
      Sets all bits to one in the specified range.
      void setShort​(long index, int value)
      Set short value at a particular index in the underlying memory chunk this ArrowBuf has access to.
      void setShort​(long index, short value)
      Set short value at a particular index in the underlying memory chunk this ArrowBuf has access to.
      ArrowBuf setZero​(long index, long length)
      Zero-out the bytes in this ArrowBuf starting at the given index for the given length.
      ArrowBuf slice()
      Returns a slice of only the readable bytes in the buffer.
      ArrowBuf slice​(long index, long length)
      Returns a slice (view) starting at index with the given length.
      String toHexString​(long start, int length)
      Return the buffer's byte contents in the form of a hex dump.
      String toString()  
      long writableBytes()
      Returns the number of bytes still available to write into this buffer before capacity is reached.
      void writeByte​(byte value)
      Set the provided byte value at the writerIndex.
      void writeByte​(int value)
      Set the lower order byte for the provided value at the writerIndex.
      void writeBytes​(byte[] src)
      Write the bytes from given byte array into this ArrowBuf starting at writerIndex.
      void writeBytes​(byte[] src, int srcIndex, int length)
      Write the bytes from given byte array starting at srcIndex into this ArrowBuf starting at writerIndex.
      void writeDouble​(double value)
      Set the provided double value at the writerIndex.
      void writeFloat​(float value)
      Set the provided float value at the writerIndex.
      void writeInt​(int value)
      Set the provided int value at the writerIndex.
      void writeLong​(long value)
      Set the provided long value at the writerIndex.
      long writerIndex()
      Get the index at which next byte will be written to.
      ArrowBuf writerIndex​(long writerIndex)
      Set the writer index for this ArrowBuf.
      void writeShort​(int value)
      Set the provided int value as short at the writerIndex.
      • Methods inherited from class org.apache.arrow.memory.ArrowBuf

        getId
    • Constructor Detail

      • DatabricksArrowBuf

        public DatabricksArrowBuf​(org.apache.arrow.memory.ReferenceManager referenceManager,
                                  org.apache.arrow.memory.BufferManager bufferManager,
                                  long capacity)
        Constructs a new DatabricksArrowBuf backed by a heap ByteBuffer.
        Parameters:
        referenceManager - The memory manager to track memory usage and reference count
        bufferManager - The buffer manager for reallocation support
        capacity - The capacity in bytes of this buffer
    • Method Detail

      • checkBytes

        public void checkBytes​(long start,
                               long end)
        Description copied from class: ArrowBuf
        Allows a function to determine whether not reading a particular string of bytes is valid.

        Will throw an exception if the memory is not readable for some reason. Only doesn't something in the case that AssertionUtil.BOUNDS_CHECKING_ENABLED is true.

        Overrides:
        checkBytes in class ArrowBuf
        Parameters:
        start - The starting position of the bytes to be read.
        end - The exclusive endpoint of the bytes to be read.
      • getReferenceManager

        public org.apache.arrow.memory.ReferenceManager getReferenceManager()
        Description copied from class: ArrowBuf
        Get reference manager for this ArrowBuf.
        Overrides:
        getReferenceManager in class ArrowBuf
        Returns:
        user provided implementation of ReferenceManager
      • capacity

        public ArrowBuf capacity​(long newCapacity)
        Description copied from class: ArrowBuf
        Adjusts the capacity of this buffer. Size increases are NOT supported.
        Overrides:
        capacity in class ArrowBuf
        Parameters:
        newCapacity - Must be in in the range [0, length).
      • order

        public ByteOrder order()
        Description copied from class: ArrowBuf
        Returns the byte order of elements in this buffer.
        Overrides:
        order in class ArrowBuf
      • readableBytes

        public long readableBytes()
        Description copied from class: ArrowBuf
        Returns the number of bytes still available to read in this buffer.
        Overrides:
        readableBytes in class ArrowBuf
      • writableBytes

        public long writableBytes()
        Description copied from class: ArrowBuf
        Returns the number of bytes still available to write into this buffer before capacity is reached.
        Overrides:
        writableBytes in class ArrowBuf
      • slice

        public ArrowBuf slice()
        Description copied from class: ArrowBuf
        Returns a slice of only the readable bytes in the buffer.
        Overrides:
        slice in class ArrowBuf
      • slice

        public ArrowBuf slice​(long index,
                              long length)
        Description copied from class: ArrowBuf
        Returns a slice (view) starting at index with the given length.
        Overrides:
        slice in class ArrowBuf
      • nioBuffer

        public ByteBuffer nioBuffer​(long index,
                                    int length)
        Description copied from class: ArrowBuf
        Make a nio byte buffer from this ArrowBuf.
        Overrides:
        nioBuffer in class ArrowBuf
      • getLong

        public long getLong​(long index)
        Description copied from class: ArrowBuf
        Get long value stored at a particular index in the underlying memory chunk this ArrowBuf has access to.
        Overrides:
        getLong in class ArrowBuf
        Parameters:
        index - index (0 based relative to this ArrowBuf) where the value will be read from
        Returns:
        8 byte long value
      • setLong

        public void setLong​(long index,
                            long value)
        Description copied from class: ArrowBuf
        Set long value at a particular index in the underlying memory chunk this ArrowBuf has access to.
        Overrides:
        setLong in class ArrowBuf
        Parameters:
        index - index (0 based relative to this ArrowBuf) where the value will be written
        value - value to write
      • getFloat

        public float getFloat​(long index)
        Description copied from class: ArrowBuf
        Get float value stored at a particular index in the underlying memory chunk this ArrowBuf has access to.
        Overrides:
        getFloat in class ArrowBuf
        Parameters:
        index - index (0 based relative to this ArrowBuf) where the value will be read from
        Returns:
        4 byte float value
      • setFloat

        public void setFloat​(long index,
                             float value)
        Description copied from class: ArrowBuf
        Set float value at a particular index in the underlying memory chunk this ArrowBuf has access to.
        Overrides:
        setFloat in class ArrowBuf
        Parameters:
        index - index (0 based relative to this ArrowBuf) where the value will be written
        value - value to write
      • getDouble

        public double getDouble​(long index)
        Description copied from class: ArrowBuf
        Get double value stored at a particular index in the underlying memory chunk this ArrowBuf has access to.
        Overrides:
        getDouble in class ArrowBuf
        Parameters:
        index - index (0 based relative to this ArrowBuf) where the value will be read from
        Returns:
        8 byte double value
      • setDouble

        public void setDouble​(long index,
                              double value)
        Description copied from class: ArrowBuf
        Set double value at a particular index in the underlying memory chunk this ArrowBuf has access to.
        Overrides:
        setDouble in class ArrowBuf
        Parameters:
        index - index (0 based relative to this ArrowBuf) where the value will be written
        value - value to write
      • getChar

        public char getChar​(long index)
        Description copied from class: ArrowBuf
        Get char value stored at a particular index in the underlying memory chunk this ArrowBuf has access to.
        Overrides:
        getChar in class ArrowBuf
        Parameters:
        index - index (0 based relative to this ArrowBuf) where the value will be read from
        Returns:
        2 byte char value
      • setChar

        public void setChar​(long index,
                            int value)
        Description copied from class: ArrowBuf
        Set char value at a particular index in the underlying memory chunk this ArrowBuf has access to.
        Overrides:
        setChar in class ArrowBuf
        Parameters:
        index - index (0 based relative to this ArrowBuf) where the value will be written
        value - value to write
      • getInt

        public int getInt​(long index)
        Description copied from class: ArrowBuf
        Get int value stored at a particular index in the underlying memory chunk this ArrowBuf has access to.
        Overrides:
        getInt in class ArrowBuf
        Parameters:
        index - index (0 based relative to this ArrowBuf) where the value will be read from
        Returns:
        4 byte int value
      • setInt

        public void setInt​(long index,
                           int value)
        Description copied from class: ArrowBuf
        Set int value at a particular index in the underlying memory chunk this ArrowBuf has access to.
        Overrides:
        setInt in class ArrowBuf
        Parameters:
        index - index (0 based relative to this ArrowBuf) where the value will be written
        value - value to write
      • getShort

        public short getShort​(long index)
        Description copied from class: ArrowBuf
        Get short value stored at a particular index in the underlying memory chunk this ArrowBuf has access to.
        Overrides:
        getShort in class ArrowBuf
        Parameters:
        index - index (0 based relative to this ArrowBuf) where the value will be read from
        Returns:
        2 byte short value
      • setShort

        public void setShort​(long index,
                             int value)
        Description copied from class: ArrowBuf
        Set short value at a particular index in the underlying memory chunk this ArrowBuf has access to.
        Overrides:
        setShort in class ArrowBuf
        Parameters:
        index - index (0 based relative to this ArrowBuf) where the value will be written
        value - value to write
      • setShort

        public void setShort​(long index,
                             short value)
        Description copied from class: ArrowBuf
        Set short value at a particular index in the underlying memory chunk this ArrowBuf has access to.
        Overrides:
        setShort in class ArrowBuf
        Parameters:
        index - index (0 based relative to this ArrowBuf) where the value will be written
        value - value to write
      • setByte

        public void setByte​(long index,
                            int value)
        Description copied from class: ArrowBuf
        Set byte value at a particular index in the underlying memory chunk this ArrowBuf has access to.
        Overrides:
        setByte in class ArrowBuf
        Parameters:
        index - index (0 based relative to this ArrowBuf) where the value will be written
        value - value to write
      • setByte

        public void setByte​(long index,
                            byte value)
        Description copied from class: ArrowBuf
        Set byte value at a particular index in the underlying memory chunk this ArrowBuf has access to.
        Overrides:
        setByte in class ArrowBuf
        Parameters:
        index - index (0 based relative to this ArrowBuf) where the value will be written
        value - value to write
      • getByte

        public byte getByte​(long index)
        Description copied from class: ArrowBuf
        Get byte value stored at a particular index in the underlying memory chunk this ArrowBuf has access to.
        Overrides:
        getByte in class ArrowBuf
        Parameters:
        index - index (0 based relative to this ArrowBuf) where the value will be read from
        Returns:
        byte value
      • readByte

        public byte readByte()
        Description copied from class: ArrowBuf
        Read the byte at readerIndex.
        Overrides:
        readByte in class ArrowBuf
        Returns:
        byte value
      • readBytes

        public void readBytes​(byte[] dst)
        Description copied from class: ArrowBuf
        Read dst.length bytes at readerIndex into dst byte array.
        Overrides:
        readBytes in class ArrowBuf
        Parameters:
        dst - byte array where the data will be written
      • writeByte

        public void writeByte​(byte value)
        Description copied from class: ArrowBuf
        Set the provided byte value at the writerIndex.
        Overrides:
        writeByte in class ArrowBuf
        Parameters:
        value - value to set
      • writeByte

        public void writeByte​(int value)
        Description copied from class: ArrowBuf
        Set the lower order byte for the provided value at the writerIndex.
        Overrides:
        writeByte in class ArrowBuf
        Parameters:
        value - value to be set
      • writeBytes

        public void writeBytes​(byte[] src)
        Description copied from class: ArrowBuf
        Write the bytes from given byte array into this ArrowBuf starting at writerIndex.
        Overrides:
        writeBytes in class ArrowBuf
        Parameters:
        src - src byte array
      • writeBytes

        public void writeBytes​(byte[] src,
                               int srcIndex,
                               int length)
        Description copied from class: ArrowBuf
        Write the bytes from given byte array starting at srcIndex into this ArrowBuf starting at writerIndex.
        Overrides:
        writeBytes in class ArrowBuf
        Parameters:
        src - src byte array
        srcIndex - index in the byte array where the copy will being from
        length - length of data to copy
      • writeShort

        public void writeShort​(int value)
        Description copied from class: ArrowBuf
        Set the provided int value as short at the writerIndex.
        Overrides:
        writeShort in class ArrowBuf
        Parameters:
        value - value to set
      • writeInt

        public void writeInt​(int value)
        Description copied from class: ArrowBuf
        Set the provided int value at the writerIndex.
        Overrides:
        writeInt in class ArrowBuf
        Parameters:
        value - value to set
      • writeLong

        public void writeLong​(long value)
        Description copied from class: ArrowBuf
        Set the provided long value at the writerIndex.
        Overrides:
        writeLong in class ArrowBuf
        Parameters:
        value - value to set
      • writeFloat

        public void writeFloat​(float value)
        Description copied from class: ArrowBuf
        Set the provided float value at the writerIndex.
        Overrides:
        writeFloat in class ArrowBuf
        Parameters:
        value - value to set
      • writeDouble

        public void writeDouble​(double value)
        Description copied from class: ArrowBuf
        Set the provided double value at the writerIndex.
        Overrides:
        writeDouble in class ArrowBuf
        Parameters:
        value - value to set
      • getBytes

        public void getBytes​(long index,
                             byte[] dst)
        Description copied from class: ArrowBuf
        Copy data from this ArrowBuf at a given index in into destination byte array.
        Overrides:
        getBytes in class ArrowBuf
        Parameters:
        index - starting index (0 based relative to the portion of memory) this ArrowBuf has access to
        dst - byte array to copy the data into
      • getBytes

        public void getBytes​(long index,
                             byte[] dst,
                             int dstIndex,
                             int length)
        Description copied from class: ArrowBuf
        Copy data from this ArrowBuf at a given index into destination byte array.
        Overrides:
        getBytes in class ArrowBuf
        Parameters:
        index - index (0 based relative to the portion of memory this ArrowBuf has access to)
        dst - byte array to copy the data into
        dstIndex - starting index in dst byte array to copy into
        length - length of data to copy from this ArrowBuf
      • setBytes

        public void setBytes​(long index,
                             byte[] src)
        Description copied from class: ArrowBuf
        Copy data from a given byte array into this ArrowBuf starting at a given index.
        Overrides:
        setBytes in class ArrowBuf
        Parameters:
        index - starting index (0 based relative to the portion of memory) this ArrowBuf has access to
        src - byte array to copy the data from
      • setBytes

        public void setBytes​(long index,
                             byte[] src,
                             int srcIndex,
                             long length)
        Description copied from class: ArrowBuf
        Copy data from a given byte array starting at the given source index into this ArrowBuf at a given index.
        Overrides:
        setBytes in class ArrowBuf
        Parameters:
        index - index (0 based relative to the portion of memory this ArrowBuf has access to)
        src - src byte array to copy the data from
        srcIndex - index in the byte array where the copy will start from
        length - length of data to copy from byte array
      • getBytes

        public void getBytes​(long index,
                             ByteBuffer dst)
        Description copied from class: ArrowBuf
        Copy data from this ArrowBuf at a given index into the destination ByteBuffer.
        Overrides:
        getBytes in class ArrowBuf
        Parameters:
        index - index (0 based relative to the portion of memory this ArrowBuf has access to)
        dst - dst ByteBuffer where the data will be copied into
      • setBytes

        public void setBytes​(long index,
                             ByteBuffer src)
        Description copied from class: ArrowBuf
        Copy data into this ArrowBuf at a given index onwards from a source ByteBuffer.
        Overrides:
        setBytes in class ArrowBuf
        Parameters:
        index - index index (0 based relative to the portion of memory this ArrowBuf has access to)
        src - src ByteBuffer where the data will be copied from
      • setBytes

        public void setBytes​(long index,
                             ByteBuffer src,
                             int srcIndex,
                             int length)
        Description copied from class: ArrowBuf
        Copy data into this ArrowBuf at a given index onwards from a source ByteBuffer starting at a given srcIndex for a certain length.
        Overrides:
        setBytes in class ArrowBuf
        Parameters:
        index - index (0 based relative to the portion of memory this ArrowBuf has access to)
        src - src ByteBuffer where the data will be copied from
        srcIndex - starting index in the src ByteBuffer where the data copy will start from
        length - length of data to copy from src ByteBuffer
      • getBytes

        public void getBytes​(long index,
                             ArrowBuf dst,
                             long dstIndex,
                             int length)
        Description copied from class: ArrowBuf
        Copy a given length of data from this ArrowBuf starting at a given index into a dst ArrowBuf at dstIndex.
        Overrides:
        getBytes in class ArrowBuf
        Parameters:
        index - index (0 based relative to the portion of memory this ArrowBuf has access to)
        dst - dst ArrowBuf where the data will be copied into
        dstIndex - index (0 based relative to the portion of memory dst ArrowBuf has access to)
        length - length of data to copy
      • setBytes

        public void setBytes​(long index,
                             ArrowBuf src,
                             long srcIndex,
                             long length)
        Description copied from class: ArrowBuf
        Copy data from src ArrowBuf starting at index srcIndex into this ArrowBuf at given index.
        Overrides:
        setBytes in class ArrowBuf
        Parameters:
        index - index index (0 based relative to the portion of memory this ArrowBuf has access to)
        src - src ArrowBuf where the data will be copied from
        srcIndex - starting index in the src ArrowBuf where the copy will begin from
        length - length of data to copy from src ArrowBuf
      • setBytes

        public void setBytes​(long index,
                             ArrowBuf src)
        Description copied from class: ArrowBuf
        Copy readableBytes() number of bytes from src ArrowBuf starting from its readerIndex into this ArrowBuf starting at the given index.
        Overrides:
        setBytes in class ArrowBuf
        Parameters:
        index - index index (0 based relative to the portion of memory this ArrowBuf has access to)
        src - src ArrowBuf where the data will be copied from
      • setBytes

        public int setBytes​(long index,
                            InputStream in,
                            int length)
                     throws IOException
        Description copied from class: ArrowBuf
        Copy a certain length of bytes from given InputStream into this ArrowBuf at the provided index.
        Overrides:
        setBytes in class ArrowBuf
        Parameters:
        index - index index (0 based relative to the portion of memory this ArrowBuf has access to)
        in - src stream to copy from
        length - length of data to copy
        Returns:
        number of bytes copied from stream into ArrowBuf
        Throws:
        IOException - on failing to read from stream
      • getBytes

        public void getBytes​(long index,
                             OutputStream out,
                             int length)
                      throws IOException
        Description copied from class: ArrowBuf
        Copy a certain length of bytes from this ArrowBuf at a given index into the given OutputStream.
        Overrides:
        getBytes in class ArrowBuf
        Parameters:
        index - index index (0 based relative to the portion of memory this ArrowBuf has access to)
        out - dst stream to copy data into
        length - length of data to copy
        Throws:
        IOException - on failing to write to stream
      • getPossibleMemoryConsumed

        public long getPossibleMemoryConsumed()
        Description copied from class: ArrowBuf
        Returns the possible memory consumed by this ArrowBuf in the worse case scenario. (not shared, connected to larger underlying buffer of allocated memory)
        Overrides:
        getPossibleMemoryConsumed in class ArrowBuf
        Returns:
        Size in bytes.
      • getActualMemoryConsumed

        public long getActualMemoryConsumed()
        Description copied from class: ArrowBuf
        Return that is Accounted for by this buffer (and its potentially shared siblings within the context of the associated allocator).
        Overrides:
        getActualMemoryConsumed in class ArrowBuf
        Returns:
        Size in bytes.
      • toHexString

        public String toHexString​(long start,
                                  int length)
        Description copied from class: ArrowBuf
        Return the buffer's byte contents in the form of a hex dump.
        Overrides:
        toHexString in class ArrowBuf
        Parameters:
        start - the starting byte index
        length - how many bytes to log
        Returns:
        A hex dump in a String.
      • print

        public void print​(StringBuilder sb,
                          int indent)
        Description copied from class: ArrowBuf
        Print detailed information of this buffer into sb.

        Most information will only be present if BaseAllocator.DEBUG is true.

        Overrides:
        print in class ArrowBuf
      • readerIndex

        public long readerIndex()
        Description copied from class: ArrowBuf
        Get the index at which the next byte will be read from.
        Overrides:
        readerIndex in class ArrowBuf
        Returns:
        reader index
      • writerIndex

        public long writerIndex()
        Description copied from class: ArrowBuf
        Get the index at which next byte will be written to.
        Overrides:
        writerIndex in class ArrowBuf
        Returns:
        writer index
      • readerIndex

        public ArrowBuf readerIndex​(long readerIndex)
        Description copied from class: ArrowBuf
        Set the reader index for this ArrowBuf.
        Overrides:
        readerIndex in class ArrowBuf
        Parameters:
        readerIndex - new reader index
        Returns:
        this ArrowBuf
      • writerIndex

        public ArrowBuf writerIndex​(long writerIndex)
        Description copied from class: ArrowBuf
        Set the writer index for this ArrowBuf.
        Overrides:
        writerIndex in class ArrowBuf
        Parameters:
        writerIndex - new writer index
        Returns:
        this ArrowBuf
      • setZero

        public ArrowBuf setZero​(long index,
                                long length)
        Description copied from class: ArrowBuf
        Zero-out the bytes in this ArrowBuf starting at the given index for the given length.
        Overrides:
        setZero in class ArrowBuf
        Parameters:
        index - index index (0 based relative to the portion of memory this ArrowBuf has access to)
        length - length of bytes to zero-out
        Returns:
        this ArrowBuf
      • setOne

        @Deprecated
        public ArrowBuf setOne​(int index,
                               int length)
        Deprecated.
        Description copied from class: ArrowBuf
        Sets all bits to one in the specified range.
        Overrides:
        setOne in class ArrowBuf
        Parameters:
        index - index index (0 based relative to the portion of memory this ArrowBuf has access to)
        length - length of bytes to set.
        Returns:
        this ArrowBuf
      • setOne

        public ArrowBuf setOne​(long index,
                               long length)
        Description copied from class: ArrowBuf
        Sets all bits to one in the specified range.
        Overrides:
        setOne in class ArrowBuf
        Parameters:
        index - index index (0 based relative to the portion of memory this ArrowBuf has access to)
        length - length of bytes to set.
        Returns:
        this ArrowBuf
      • reallocIfNeeded

        public ArrowBuf reallocIfNeeded​(long size)
        Description copied from class: ArrowBuf
        Returns this if size is less than ArrowBuf.capacity(), otherwise delegates to BufferManager.replace(ArrowBuf, long) to get a new buffer.
        Overrides:
        reallocIfNeeded in class ArrowBuf
      • getOffset

        public int getOffset()
        Returns the offset within the underlying ByteBuffer where this buffer's data starts. This is used for sliced buffers that share the same underlying ByteBuffer.
        Returns:
        the offset in bytes