Class ByteArray

java.lang.Object
org.apache.hadoop.io.file.tfile.ByteArray
All Implemented Interfaces:
RawComparable

@Private @Unstable public final class ByteArray extends Object implements RawComparable
Adaptor class to wrap byte-array backed objects (including java byte array) as RawComparable objects.
  • Constructor Details

    • ByteArray

      public ByteArray(BytesWritable other)
      Constructing a ByteArray from a BytesWritable.
      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 offset
      len - the length of the consecutive bytes to be wrapped.
  • Method Details

    • buffer

      public byte[] buffer()
      Description copied from interface: RawComparable
      Get the underlying byte array.
      Specified by:
      buffer in interface RawComparable
      Returns:
      the underlying buffer.
    • offset

      public int offset()
      Description copied from interface: RawComparable
      Get the offset of the first byte in the byte array.
      Specified by:
      offset in interface RawComparable
      Returns:
      the offset in the buffer.
    • size

      public int size()
      Description copied from interface: RawComparable
      Get the size of the byte range in the byte array.
      Specified by:
      size in interface RawComparable
      Returns:
      the size of the byte array.