Package org.apache.hadoop.hbase.util
Class SimpleByteRange
java.lang.Object
org.apache.hadoop.hbase.util.AbstractByteRange
org.apache.hadoop.hbase.util.SimpleByteRange
- All Implemented Interfaces:
Comparable<ByteRange>
,ByteRange
A read only version of the
ByteRange
.-
Field Summary
Fields inherited from class org.apache.hadoop.hbase.util.AbstractByteRange
bytes, hash, length, offset, UNSET_HASH_VALUE
-
Constructor Summary
ConstructorDescriptionSimpleByteRange
(byte[] bytes) Create a newByteRange
over the providedbytes
.SimpleByteRange
(byte[] bytes, int offset, int length) Create a newByteRange
over the providedbytes
.SimpleByteRange
(int capacity) -
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 VLongset
(byte[] bytes) Reuse thisByteRange
over a new byte[].set
(byte[] bytes, int offset, int length) Reuse thisByteRange
over a new byte[].set
(int capacity) Reuse thisByteRange
over a new byte[].Create 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, setLength, setOffset, toString
-
Constructor Details
-
SimpleByteRange
public SimpleByteRange() -
SimpleByteRange
-
SimpleByteRange
Create a newByteRange
over the providedbytes
.- Parameters:
bytes
- The array to wrap.
-
SimpleByteRange
Create a newByteRange
over the providedbytes
.- Parameters:
bytes
- The array to wrap.offset
- The offset intobytes
considered the beginning of this range.length
- 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. -
set
Description copied from interface:ByteRange
Reuse thisByteRange
over a new byte[].offset
is set to 0 andlength
is set tocapacity
.- Specified by:
set
in interfaceByteRange
- Overrides:
set
in classAbstractByteRange
- Parameters:
capacity
- the size of a new byte[].
-
set
Description copied from interface:ByteRange
Reuse thisByteRange
over a new byte[].offset
is set to 0 andlength
is set tobytes.length
. A nullbytes
IS supported, in which case this method will behave equivalently toByteRange.unset()
.- Specified by:
set
in interfaceByteRange
- Overrides:
set
in classAbstractByteRange
- Parameters:
bytes
- the array to wrap.
-
set
Description copied from interface:ByteRange
Reuse thisByteRange
over a new byte[]. A nullbytes
IS supported, in which case this method will behave equivalently toByteRange.unset()
, regardless of the values ofoffset
andlength
.- Specified by:
set
in interfaceByteRange
- Overrides:
set
in classAbstractByteRange
- Parameters:
bytes
- The array to wrap.offset
- The offset intobytes
considered the beginning of this range.length
- The length of this range.- 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
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.
-
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
-
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
-
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
-
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
-
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
-