Package org.apache.hadoop.io.file.tfile
Class ByteArray
java.lang.Object
org.apache.hadoop.io.file.tfile.ByteArray
- All Implemented Interfaces:
RawComparable
Adaptor class to wrap byte-array backed objects (including java byte array)
as RawComparable objects.
-
Constructor Summary
ConstructorsConstructorDescriptionByteArray(byte[] buffer) Wrap a whole byte array as a RawComparable.ByteArray(byte[] buffer, int offset, int len) Wrap a partial byte array as a RawComparable.ByteArray(BytesWritable other) Constructing a ByteArray from aBytesWritable. -
Method Summary
-
Constructor Details
-
ByteArray
Constructing a ByteArray from aBytesWritable.- Parameters:
other- other.
-
ByteArray
public ByteArray(byte[] buffer) Wrap a whole byte array as a RawComparable.- Parameters:
buffer- the byte array buffer.
-
ByteArray
public ByteArray(byte[] buffer, int offset, int len) Wrap a partial byte array as a RawComparable.- Parameters:
buffer- the byte array buffer.offset- the starting offsetlen- the length of the consecutive bytes to be wrapped.
-
-
Method Details
-
buffer
public byte[] buffer()Description copied from interface:RawComparableGet the underlying byte array.- Specified by:
bufferin interfaceRawComparable- Returns:
- the underlying buffer.
-
offset
public int offset()Description copied from interface:RawComparableGet the offset of the first byte in the byte array.- Specified by:
offsetin interfaceRawComparable- Returns:
- the offset in the buffer.
-
size
public int size()Description copied from interface:RawComparableGet the size of the byte range in the byte array.- Specified by:
sizein interfaceRawComparable- Returns:
- the size of the byte array.
-