Package org.apache.hadoop.hbase.util
Class SimpleMutableByteRange
java.lang.Object
org.apache.hadoop.hbase.util.AbstractByteRange
org.apache.hadoop.hbase.util.SimpleMutableByteRange
- All Implemented Interfaces:
Comparable<ByteRange>,ByteRange
A basic mutable
ByteRange implementation.-
Field Summary
Fields inherited from class org.apache.hadoop.hbase.util.AbstractByteRange
bytes, hash, length, offset, UNSET_HASH_VALUE -
Constructor Summary
ConstructorsConstructorDescriptionCreate a newByteRangelacking a backing array and with an undefined viewport.SimpleMutableByteRange(byte[] bytes) Create a newByteRangeover the providedbytes.SimpleMutableByteRange(byte[] bytes, int offset, int length) Create a newByteRangeover the providedbytes.SimpleMutableByteRange(int capacity) Create a newByteRangeover a new backing array of sizecapacity. -
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 VLongCreate 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 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, set, set, set, setLength, setOffset, toString
-
Constructor Details
-
SimpleMutableByteRange
public SimpleMutableByteRange()Create a newByteRangelacking a backing array and with an undefined viewport. -
SimpleMutableByteRange
Create a newByteRangeover a new backing array of sizecapacity. The range's offset and length are 0 andcapacity, respectively. the size of the backing array. -
SimpleMutableByteRange
Create a newByteRangeover the providedbytes. The array to wrap. -
SimpleMutableByteRange
Create a newByteRangeover the providedbytes. The array to wrap. The offset intobytesconsidered the beginning of this range. 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. -
put
Description copied from interface:ByteRangeStorevalatindex.- Parameters:
index- the index in the range wherevalis stored.val- the value to store.- Returns:
- this.
-
put
Description copied from interface:ByteRangeStorevalatindex.- 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.- 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.
-
putShort
Description copied from interface:ByteRangeStore the short value atindex- Parameters:
index- the index in the range wherevalis storedval- the value to store
-
putInt
Description copied from interface:ByteRangeStore the int value atindex- Parameters:
index- the index in the range wherevalis storedval- the value to store
-
putLong
Description copied from interface:ByteRangeStore the long value atindex- Parameters:
index- the index in the range wherevalis storedval- the value to store
-
putVLong
Description copied from interface:ByteRangeStore the long value atindexas a VLong- Parameters:
index- the index in the range wherevalis storedval- the value to store- Returns:
- number of bytes written
-
deepCopy
Description copied from interface:ByteRangeCreate a newByteRangewith new backing byte[] containing a copy of the content fromthisrange's window.- Returns:
- Deep copy
-
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
- Overrides:
equalsin classAbstractByteRange
-