Class SimpleByteRange

java.lang.Object
org.apache.hadoop.hbase.util.AbstractByteRange
org.apache.hadoop.hbase.util.SimpleByteRange
All Implemented Interfaces:
Comparable<ByteRange>, ByteRange

@Public public class SimpleByteRange extends AbstractByteRange
A read only version of the ByteRange.
  • Constructor Details

    • SimpleByteRange

      public SimpleByteRange()
    • SimpleByteRange

      public SimpleByteRange(int capacity)
    • SimpleByteRange

      public SimpleByteRange(byte[] bytes)
      Create a new ByteRange over the provided bytes.
      Parameters:
      bytes - The array to wrap.
    • SimpleByteRange

      public SimpleByteRange(byte[] bytes, int offset, int length)
      Create a new ByteRange over the provided bytes.
      Parameters:
      bytes - The array to wrap.
      offset - The offset into bytes considered the beginning of this range.
      length - The length of this range.
  • Method Details

    • unset

      public ByteRange unset()
      Description copied from interface: ByteRange
      Nullifies this ByteRange. That is, it becomes a husk, being a range over no byte[] whatsoever.
    • set

      public ByteRange set(int capacity)
      Description copied from interface: ByteRange
      Reuse this ByteRange over a new byte[]. offset is set to 0 and length is set to capacity.
      Specified by:
      set in interface ByteRange
      Overrides:
      set in class AbstractByteRange
      Parameters:
      capacity - the size of a new byte[].
    • set

      public ByteRange set(byte[] bytes)
      Description copied from interface: ByteRange
      Reuse this ByteRange over a new byte[]. offset is set to 0 and length is set to bytes.length. A null bytes IS supported, in which case this method will behave equivalently to ByteRange.unset().
      Specified by:
      set in interface ByteRange
      Overrides:
      set in class AbstractByteRange
      Parameters:
      bytes - the array to wrap.
    • set

      public ByteRange set(byte[] bytes, int offset, int length)
      Description copied from interface: ByteRange
      Reuse this ByteRange over a new byte[]. A null bytes IS supported, in which case this method will behave equivalently to ByteRange.unset(), regardless of the values of offset and length.
      Specified by:
      set in interface ByteRange
      Overrides:
      set in class AbstractByteRange
      Parameters:
      bytes - The array to wrap.
      offset - The offset into bytes considered the beginning of this range.
      length - The length of this range.
      Returns:
      this.
    • put

      public ByteRange put(int index, byte val)
      Description copied from interface: ByteRange
      Store val at index.
      Parameters:
      index - the index in the range where val is stored.
      val - the value to store.
      Returns:
      this.
    • put

      public ByteRange put(int index, byte[] val)
      Description copied from interface: ByteRange
      Store val at index.
      Parameters:
      index - the index in the range where val is stored.
      val - the value to store.
      Returns:
      this.
    • put

      public ByteRange put(int index, byte[] val, int offset, int length)
      Description copied from interface: ByteRange
      Store length bytes from val into this range, starting at index. Bytes from val are copied starting at offset into the range.
      Parameters:
      index - position in this range to start the copy.
      val - the value to store.
      offset - the offset in val from which to start copying.
      length - the number of bytes to copy from val.
      Returns:
      this.
    • shallowCopy

      Description copied from interface: ByteRange
      Create a new ByteRange that points at this range's byte[]. Modifying the shallowCopy will modify the bytes in this range's array. Pass over the hash code if it is already cached.
      Returns:
      new ByteRange object referencing this range's byte[].
    • shallowCopySubRange

      public ByteRange shallowCopySubRange(int innerOffset, int copyLength)
      Description copied from interface: ByteRange
      Create a new ByteRange that points at this range's byte[]. The new range can have different values for offset and length, but modifying the shallowCopy will modify the bytes in this range's array. Pass over the hash code if it is already cached.
      Parameters:
      innerOffset - First byte of clone will be this.offset + copyOffset.
      copyLength - Number of bytes in the clone.
      Returns:
      new ByteRange object referencing this range's byte[].
    • equals

      public boolean equals(Object thatObject)
      Overrides:
      equals in class AbstractByteRange
    • deepCopy

      public ByteRange deepCopy()
      Description copied from interface: ByteRange
      Create a new ByteRange with new backing byte[] containing a copy of the content from this range's window.
      Returns:
      Deep copy
    • putInt

      public ByteRange putInt(int index, int val)
      Description copied from interface: ByteRange
      Store the int value at index
      Parameters:
      index - the index in the range where val is stored
      val - the value to store
    • putLong

      public ByteRange putLong(int index, long val)
      Description copied from interface: ByteRange
      Store the long value at index
      Parameters:
      index - the index in the range where val is stored
      val - the value to store
    • putShort

      public ByteRange putShort(int index, short val)
      Description copied from interface: ByteRange
      Store the short value at index
      Parameters:
      index - the index in the range where val is stored
      val - the value to store
    • putVLong

      public int putVLong(int index, long val)
      Description copied from interface: ByteRange
      Store the long value at index as a VLong
      Parameters:
      index - the index in the range where val is stored
      val - the value to store
      Returns:
      number of bytes written