Class ReusableByteArray

java.lang.Object
org.apache.arrow.vector.util.ReusableByteArray
All Implemented Interfaces:
ReusableBuffer<byte[]>
Direct Known Subclasses:
Text

public class ReusableByteArray extends Object implements ReusableBuffer<byte[]>
A wrapper around byte arrays for repeated writing.
  • Field Details

    • EMPTY_BYTES

      protected static final byte[] EMPTY_BYTES
    • bytes

      protected byte[] bytes
    • length

      protected int length
  • Constructor Details

    • ReusableByteArray

      public ReusableByteArray()
    • ReusableByteArray

      public ReusableByteArray(byte[] data)
  • Method Details

    • getLength

      public long getLength()
      Get the number of bytes in the byte array.
      Specified by:
      getLength in interface ReusableBuffer<byte[]>
      Returns:
      the number of bytes in the byte array
    • getBuffer

      public byte[] getBuffer()
      Specified by:
      getBuffer in interface ReusableBuffer<byte[]>
    • set

      public void set(ArrowBuf srcBytes, long start, long len)
      Specified by:
      set in interface ReusableBuffer<byte[]>
    • set

      public void set(byte[] srcBytes, long start, long len)
      Specified by:
      set in interface ReusableBuffer<byte[]>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setCapacity

      protected void setCapacity(int len, boolean keepData)
      Sets the capacity of this object to at least len bytes. If the current buffer is longer, then the capacity and existing content of the buffer are unchanged. If len is larger than the current capacity, the Text object's capacity is increased to match.
      Parameters:
      len - the number of bytes we need
      keepData - should the old data be kept