Class SimpleByteRange
- java.lang.Object
-
- com.mapr.org.apache.hadoop.hbase.util.AbstractByteRange
-
- com.mapr.org.apache.hadoop.hbase.util.SimpleByteRange
-
public class SimpleByteRange extends AbstractByteRange
A read only version of theByteRange.
-
-
Field Summary
-
Fields inherited from class com.mapr.org.apache.hadoop.hbase.util.AbstractByteRange
bytes, hash, length, offset, UNSET_HASH_VALUE
-
-
Constructor Summary
Constructors Constructor Description SimpleByteRange()SimpleByteRange(byte[] bytes)Create a newByteRangeover the providedbytes.SimpleByteRange(byte[] bytes, int offset, int length)Create a newByteRangeover the providedbytes.SimpleByteRange(int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteRangedeepCopy()Create a newByteRangewith new backing byte[] containing a copy of the content fromthisrange's window.booleanequals(java.lang.Object thatObject)ByteRangeput(int index, byte val)Storevalatindex.ByteRangeput(int index, byte[] val)Storevalatindex.ByteRangeput(int index, byte[] val, int offset, int length)Storelengthbytes fromvalinto this range, starting atindex.ByteRangeputInt(int index, int val)Store the int value atindexByteRangeputLong(int index, long val)Store the long value atindexByteRangeputShort(int index, short val)Store the short value atindexintputVLong(int index, long val)Store the long value atindexas a VLongByteRangeset(byte[] bytes)Reuse thisByteRangeover a new byte[].ByteRangeset(byte[] bytes, int offset, int length)Reuse thisByteRangeover a new byte[].ByteRangeset(int capacity)Reuse thisByteRangeover a new byte[].ByteRangeshallowCopy()Create a newByteRangethat points at this range's byte[].ByteRangeshallowCopySubRange(int innerOffset, int copyLength)Create a newByteRangethat points at this range's byte[].ByteRangeunset()Nullifies this ByteRange.-
Methods inherited from class com.mapr.org.apache.hadoop.hbase.util.AbstractByteRange
clearHashCache, compareTo, deepCopySubRangeTo, deepCopyTo, deepCopyToNewArray, get, get, get, getBytes, getInt, getLength, getLong, getOffset, getShort, getVLong, getVLongSize, hashCode, isEmpty, isEmpty, isHashCached, setLength, setOffset, toString
-
-
-
-
Constructor Detail
-
SimpleByteRange
public SimpleByteRange()
-
SimpleByteRange
public SimpleByteRange(int capacity)
-
SimpleByteRange
public SimpleByteRange(byte[] bytes)
Create a newByteRangeover the providedbytes.- Parameters:
bytes- The array to wrap.
-
SimpleByteRange
public SimpleByteRange(byte[] bytes, int offset, int length)Create a newByteRangeover the providedbytes.- Parameters:
bytes- The array to wrap.offset- The offset intobytesconsidered the beginning of this range.length- The length of this range.
-
-
Method Detail
-
unset
public ByteRange unset()
Description copied from interface:ByteRangeNullifies this ByteRange. That is, it becomes a husk, being a range over no byte[] whatsoever.- Specified by:
unsetin interfaceByteRange- Specified by:
unsetin classAbstractByteRange- Returns:
- this
-
set
public ByteRange set(int capacity)
Description copied from interface:ByteRangeReuse thisByteRangeover a new byte[].offsetis set to 0 andlengthis set tocapacity.- Specified by:
setin interfaceByteRange- Overrides:
setin classAbstractByteRange- Parameters:
capacity- the size of a new byte[].- Returns:
- this
-
set
public ByteRange set(byte[] bytes)
Description copied from interface:ByteRangeReuse thisByteRangeover a new byte[].offsetis set to 0 andlengthis set tobytes.length. A nullbytesIS supported, in which case this method will behave equivalently toByteRange.unset().- Specified by:
setin interfaceByteRange- Overrides:
setin classAbstractByteRange- Parameters:
bytes- the array to wrap.- Returns:
- this
-
set
public ByteRange set(byte[] bytes, int offset, int length)
Description copied from interface:ByteRangeReuse thisByteRangeover a new byte[]. A nullbytesIS supported, in which case this method will behave equivalently toByteRange.unset(), regardless of the values ofoffsetandlength.- Specified by:
setin interfaceByteRange- Overrides:
setin classAbstractByteRange- Parameters:
bytes- The array to wrap.offset- The offset intobytesconsidered 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:ByteRangeStorevalatindex.- Specified by:
putin interfaceByteRange- Specified by:
putin classAbstractByteRange- Parameters:
index- the index in the range wherevalis stored.val- the value to store.- Returns:
- this.
-
put
public ByteRange put(int index, byte[] val)
Description copied from interface:ByteRangeStorevalatindex.- Specified by:
putin interfaceByteRange- Specified by:
putin classAbstractByteRange- Parameters:
index- the index in the range wherevalis stored.val- the value to store.- Returns:
- this.
-
put
public ByteRange put(int index, byte[] val, int offset, int length)
Description copied from interface:ByteRangeStorelengthbytes fromvalinto this range, starting atindex. Bytes fromvalare copied starting atoffsetinto the range.- Specified by:
putin interfaceByteRange- Specified by:
putin classAbstractByteRange- Parameters:
index- position in this range to start the copy.val- the value to store.offset- the offset invalfrom which to start copying.length- the number of bytes to copy fromval.- Returns:
- this.
-
shallowCopy
public ByteRange shallowCopy()
Description copied from interface:ByteRangeCreate a newByteRangethat 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
ByteRangeobject referencing this range's byte[].
-
shallowCopySubRange
public ByteRange shallowCopySubRange(int innerOffset, int copyLength)
Description copied from interface:ByteRangeCreate a newByteRangethat 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
ByteRangeobject referencing this range's byte[].
-
equals
public boolean equals(java.lang.Object thatObject)
- Overrides:
equalsin classjava.lang.Object
-
deepCopy
public ByteRange deepCopy()
Description copied from interface:ByteRangeCreate a newByteRangewith new backing byte[] containing a copy of the content fromthisrange's window.- Returns:
- Deep copy
-
putInt
public ByteRange putInt(int index, int val)
Description copied from interface:ByteRangeStore the int value atindex- Specified by:
putIntin interfaceByteRange- Specified by:
putIntin classAbstractByteRange- Parameters:
index- the index in the range wherevalis storedval- the value to store- Returns:
- this
-
putLong
public ByteRange putLong(int index, long val)
Description copied from interface:ByteRangeStore the long value atindex- Specified by:
putLongin interfaceByteRange- Specified by:
putLongin classAbstractByteRange- Parameters:
index- the index in the range wherevalis storedval- the value to store- Returns:
- this
-
putShort
public ByteRange putShort(int index, short val)
Description copied from interface:ByteRangeStore the short value atindex- Specified by:
putShortin interfaceByteRange- Specified by:
putShortin classAbstractByteRange- Parameters:
index- the index in the range wherevalis storedval- the value to store- Returns:
- this
-
putVLong
public int putVLong(int index, long val)Description copied from interface:ByteRangeStore the long value atindexas a VLong- Specified by:
putVLongin interfaceByteRange- Specified by:
putVLongin classAbstractByteRange- Parameters:
index- the index in the range wherevalis storedval- the value to store- Returns:
- number of bytes written
-
-