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[]Get the buffer backing this ReusableBuffer.longGet the number of bytes in the byte array.inthashCode()voidset(byte[] srcBytes, long start, long len) voidSet the buffer to the contents of the given ArrowBuf.protected 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()Description copied from interface:ReusableBufferGet the buffer backing this ReusableBuffer.- Specified by:
getBufferin interfaceReusableBuffer<byte[]>
-
set
Description copied from interface:ReusableBufferSet the buffer to the contents of the given ArrowBuf. The internal buffer must resize if it cannot fit the contents of the data.- Specified by:
setin interfaceReusableBuffer<byte[]>- Parameters:
srcBytes- the data to copy fromstart- the first position of the new datalen- the number of bytes of the new data
-
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
-