Class SimpleByteRange
java.lang.Object
com.mapr.org.apache.hadoop.hbase.util.AbstractByteRange
com.mapr.org.apache.hadoop.hbase.util.SimpleByteRange
- All Implemented Interfaces:
ByteRange,Comparable<ByteRange>
A read only version of the
ByteRange.-
Field Summary
Fields inherited from class com.mapr.org.apache.hadoop.hbase.util.AbstractByteRange
bytes, hash, length, offset, UNSET_HASH_VALUE -
Constructor Summary
ConstructorsConstructorDescriptionSimpleByteRange(byte[] bytes) Create a newByteRangeover the providedbytes.SimpleByteRange(byte[] bytes, int offset, int length) Create a newByteRangeover the providedbytes.SimpleByteRange(int capacity) -
Method Summary
Modifier and TypeMethodDescriptiondeepCopy()Create a newByteRangewith new backing byte[] containing a copy of the content fromthisrange's window.booleanput(int index, byte val) Storevalatindex.put(int index, byte[] val) Storevalatindex.put(int index, byte[] val, int offset, int length) Storelengthbytes fromvalinto this range, starting atindex.putInt(int index, int val) Store the int value atindexputLong(int index, long val) Store the long value atindexputShort(int index, short val) Store the short value atindexintputVLong(int index, long val) Store the long value atindexas a VLongset(byte[] bytes) Reuse thisByteRangeover a new byte[].set(byte[] bytes, int offset, int length) Reuse thisByteRangeover a new byte[].set(int capacity) Reuse thisByteRangeover a new byte[].Create a newByteRangethat points at this range's byte[].shallowCopySubRange(int innerOffset, int copyLength) Create a newByteRangethat points at this range's byte[].unset()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 Details
-
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 Details
-
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
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
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
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
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
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
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
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
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
-
deepCopy
Description copied from interface:ByteRangeCreate a newByteRangewith new backing byte[] containing a copy of the content fromthisrange's window.- Returns:
- Deep copy
-
putInt
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
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
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
-