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
ConstructorDescriptionCreate a newByteRange
lacking a backing array and with an undefined viewport.SimpleMutableByteRange
(byte[] bytes) Create a newByteRange
over the providedbytes
.SimpleMutableByteRange
(byte[] bytes, int offset, int length) Create a newByteRange
over the providedbytes
.SimpleMutableByteRange
(int capacity) Create a newByteRange
over a new backing array of sizecapacity
. -
Method Summary
Modifier and TypeMethodDescriptiondeepCopy()
Create a newByteRange
with new backing byte[] containing a copy of the content fromthis
range's window.boolean
put
(int index, byte val) Storeval
atindex
.put
(int index, byte[] val) Storeval
atindex
.put
(int index, byte[] val, int offset, int length) Storelength
bytes fromval
into this range, starting atindex
.putInt
(int index, int val) Store the int value atindex
putLong
(int index, long val) Store the long value atindex
putShort
(int index, short val) Store the short value atindex
int
putVLong
(int index, long val) Store the long value atindex
as a VLongCreate a newByteRange
that points at this range's byte[].shallowCopySubRange
(int innerOffset, int copyLength) Create a newByteRange
that 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 newByteRange
lacking a backing array and with an undefined viewport. -
SimpleMutableByteRange
Create a newByteRange
over 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 newByteRange
over the providedbytes
. The array to wrap. -
SimpleMutableByteRange
Create a newByteRange
over the providedbytes
. The array to wrap. The offset intobytes
considered the beginning of this range. The length of this range.
-
-
Method Details
-
unset
Description copied from interface:ByteRange
Nullifies this ByteRange. That is, it becomes a husk, being a range over no byte[] whatsoever. -
put
Description copied from interface:ByteRange
Storeval
atindex
.- Parameters:
index
- the index in the range whereval
is stored.val
- the value to store.- Returns:
- this.
-
put
Description copied from interface:ByteRange
Storeval
atindex
.- Parameters:
index
- the index in the range whereval
is stored.val
- the value to store.- Returns:
- this.
-
put
Description copied from interface:ByteRange
Storelength
bytes fromval
into this range, starting atindex
. Bytes fromval
are copied starting atoffset
into the range.- Parameters:
index
- position in this range to start the copy.val
- the value to store.offset
- the offset inval
from which to start copying.length
- the number of bytes to copy fromval
.- Returns:
- this.
-
putShort
Description copied from interface:ByteRange
Store the short value atindex
- Parameters:
index
- the index in the range whereval
is storedval
- the value to store
-
putInt
Description copied from interface:ByteRange
Store the int value atindex
- Parameters:
index
- the index in the range whereval
is storedval
- the value to store
-
putLong
Description copied from interface:ByteRange
Store the long value atindex
- Parameters:
index
- the index in the range whereval
is storedval
- the value to store
-
putVLong
Description copied from interface:ByteRange
Store the long value atindex
as a VLong- Parameters:
index
- the index in the range whereval
is storedval
- the value to store- Returns:
- number of bytes written
-
deepCopy
Description copied from interface:ByteRange
Create a newByteRange
with new backing byte[] containing a copy of the content fromthis
range's window.- Returns:
- Deep copy
-
shallowCopy
Description copied from interface:ByteRange
Create a newByteRange
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
Description copied from interface:ByteRange
Create a newByteRange
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
- Overrides:
equals
in classAbstractByteRange
-