Package org.apache.arrow.vector.util
Class ReusableByteArray
java.lang.Object
org.apache.arrow.vector.util.ReusableByteArray
- All Implemented Interfaces:
ReusableBuffer<byte[]>
- Direct Known Subclasses:
Text
A wrapper around byte arrays for repeated writing.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byte[]protected static final byte[]protected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbyte[]longGet the number of bytes in the byte array.inthashCode()voidset(byte[] srcBytes, long start, long len) voidprotected voidsetCapacity(int len, boolean keepData) Sets the capacity of this object to at leastlenbytes.toString()
-
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:
getLengthin interfaceReusableBuffer<byte[]>- Returns:
- the number of bytes in the byte array
-
getBuffer
public byte[] getBuffer()- Specified by:
getBufferin interfaceReusableBuffer<byte[]>
-
set
- Specified by:
setin interfaceReusableBuffer<byte[]>
-
set
public void set(byte[] srcBytes, long start, long len) - Specified by:
setin interfaceReusableBuffer<byte[]>
-
equals
-
hashCode
public int hashCode() -
toString
-
setCapacity
protected void setCapacity(int len, boolean keepData) Sets the capacity of this object to at leastlenbytes. If the current buffer is longer, then the capacity and existing content of the buffer are unchanged. Iflenis larger than the current capacity, the Text object's capacity is increased to match.- Parameters:
len- the number of bytes we needkeepData- should the old data be kept
-