public final class DynamicByteArray extends Object
Constructor and Description |
---|
DynamicByteArray() |
DynamicByteArray(int numChunks,
int chunkSize) |
Modifier and Type | Method and Description |
---|---|
int |
add(byte value) |
int |
add(byte[] value,
int valueOffset,
int valueLength)
Copy a slice of a byte array into our buffer.
|
void |
clear()
Clear the array to its original pristine state.
|
int |
compare(byte[] other,
int otherOffset,
int otherLength,
int ourOffset,
int ourLength)
Byte compare a set of bytes against the bytes in this dynamic array.
|
byte[] |
get()
Gets all the bytes of the array.
|
byte |
get(int index) |
long |
getSizeInBytes()
Get the size of the buffers.
|
void |
readAll(InputStream in)
Read the entire stream into this array.
|
void |
set(int index,
byte value) |
void |
setByteBuffer(ByteBuffer result,
int offset,
int length) |
void |
setText(org.apache.hadoop.io.Text result,
int offset,
int length)
Set a text value from the bytes in this dynamic array.
|
int |
size()
Get the size of the array.
|
String |
toString() |
void |
write(OutputStream out,
int offset,
int length)
Write out a range of this dynamic array to an output stream.
|
public DynamicByteArray()
public DynamicByteArray(int numChunks, int chunkSize)
public byte get(int index)
public void set(int index, byte value)
public int add(byte value)
public int add(byte[] value, int valueOffset, int valueLength)
value
- the array to copy fromvalueOffset
- the first location to copy from valuevalueLength
- the number of bytes to copy from valuepublic void readAll(InputStream in) throws IOException
in
- the stream to read fromIOException
public int compare(byte[] other, int otherOffset, int otherLength, int ourOffset, int ourLength)
other
- source of the other bytesotherOffset
- start offset in the other arrayotherLength
- number of bytes in the other arrayourOffset
- the offset in our arrayourLength
- the number of bytes in our arraypublic int size()
public void clear()
public void setText(org.apache.hadoop.io.Text result, int offset, int length)
result
- the value to setoffset
- the start of the bytes to copylength
- the number of bytes to copypublic void write(OutputStream out, int offset, int length) throws IOException
out
- the stream to write tooffset
- the first offset to writelength
- the number of bytes to writeIOException
public void setByteBuffer(ByteBuffer result, int offset, int length)
public byte[] get()
public long getSizeInBytes()
Copyright © 2016 The Apache Software Foundation. All rights reserved.