Class SimplePositionedByteRange
java.lang.Object
com.mapr.org.apache.hadoop.hbase.util.AbstractByteRange
com.mapr.org.apache.hadoop.hbase.util.AbstractPositionedByteRange
com.mapr.org.apache.hadoop.hbase.util.SimplePositionedByteRange
- All Implemented Interfaces:
ByteRange,PositionedByteRange,Comparable<ByteRange>
Extends the basic
SimpleMutableByteRange implementation with position
support and it is a readonly version. position is considered
transient, not fundamental to the definition of the range, and does not
participate in AbstractByteRange.compareTo(ByteRange), AbstractByteRange.hashCode(), or
Object.equals(Object). Position is retained by copy operations.-
Field Summary
Fields inherited from class com.mapr.org.apache.hadoop.hbase.util.AbstractPositionedByteRange
limit, positionFields inherited from class com.mapr.org.apache.hadoop.hbase.util.AbstractByteRange
bytes, hash, length, offset, UNSET_HASH_VALUE -
Constructor Summary
ConstructorsConstructorDescriptionCreate a newPositionedByteRangelacking a backing array and with an undefined viewport.SimplePositionedByteRange(byte[] bytes) Create a newPositionedByteRangeover the providedbytes.SimplePositionedByteRange(byte[] bytes, int offset, int length) Create a newPositionedByteRangeover the providedbytes.SimplePositionedByteRange(int capacity) Create a newPositionedByteRangeover 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.get(int index, byte[] dst) Filldstwith bytes from the range, starting fromindex.get(int index, byte[] dst, int offset, int length) Filldstwith bytes from the range, starting fromindex.put(byte val) Storevalat the next position in this range.put(byte[] val) Store the content ofvalin this range, starting at the next position.put(byte[] val, int offset, int length) Storelengthbytes fromvalinto this range.put(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 val) Store intvalat the next position in this range.putInt(int index, int val) Store the int value atindexputLong(int index, long val) Store the long value atindexputLong(long val) Store longvalat the next position in this range.putShort(int index, short val) Store the short value atindexputShort(short val) Store shortvalat the next position in this range.intputVLong(int index, long val) Store the long value atindexas a VLongintputVLong(long val) Store the longvalat the next position as 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[].setLimit(int limit) Limits the byte range upto a specified value.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.AbstractPositionedByteRange
get, get, get, getInt, getLimit, getLong, getPosition, getRemaining, getShort, getVLong, peek, setLength, setOffset, setPositionMethods inherited from class com.mapr.org.apache.hadoop.hbase.util.AbstractByteRange
clearHashCache, compareTo, deepCopySubRangeTo, deepCopyTo, deepCopyToNewArray, get, getBytes, getInt, getLength, getLong, getOffset, getShort, getVLong, getVLongSize, hashCode, isEmpty, isEmpty, isHashCached, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.mapr.org.apache.hadoop.hbase.util.ByteRange
deepCopySubRangeTo, deepCopyTo, deepCopyToNewArray, get, getBytes, getInt, getLength, getLong, getOffset, getShort, getVLong, isEmptyMethods inherited from interface java.lang.Comparable
compareTo
-
Constructor Details
-
SimplePositionedByteRange
public SimplePositionedByteRange()Create a newPositionedByteRangelacking a backing array and with an undefined viewport. -
SimplePositionedByteRange
public SimplePositionedByteRange(int capacity) Create a newPositionedByteRangeover a new backing array of sizecapacity. The range's offset and length are 0 andcapacity, respectively.- Parameters:
capacity- the size of the backing array.
-
SimplePositionedByteRange
public SimplePositionedByteRange(byte[] bytes) Create a newPositionedByteRangeover the providedbytes.- Parameters:
bytes- The array to wrap.
-
SimplePositionedByteRange
public SimplePositionedByteRange(byte[] bytes, int offset, int length) Create a newPositionedByteRangeover 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
-
set
Description copied from interface:ByteRangeReuse thisByteRangeover a new byte[].offsetis set to 0 andlengthis set tocapacity.- Specified by:
setin interfaceByteRange- Specified by:
setin interfacePositionedByteRange- Overrides:
setin classAbstractPositionedByteRange- 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- Specified by:
setin interfacePositionedByteRange- Overrides:
setin classAbstractPositionedByteRange- 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- Specified by:
setin interfacePositionedByteRange- Overrides:
setin classAbstractPositionedByteRange- 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:PositionedByteRangeStorevalat the next position in this range.- Specified by:
putin interfacePositionedByteRange- Specified by:
putin classAbstractPositionedByteRange- Parameters:
val- the new value.- Returns:
- this.
-
putShort
Description copied from interface:PositionedByteRangeStore shortvalat the next position in this range.- Specified by:
putShortin interfacePositionedByteRange- Specified by:
putShortin classAbstractPositionedByteRange- Parameters:
val- the new value.- Returns:
- this.
-
putInt
Description copied from interface:PositionedByteRangeStore intvalat the next position in this range.- Specified by:
putIntin interfacePositionedByteRange- Specified by:
putIntin classAbstractPositionedByteRange- Parameters:
val- the new value.- Returns:
- this.
-
putLong
Description copied from interface:PositionedByteRangeStore longvalat the next position in this range.- Specified by:
putLongin interfacePositionedByteRange- Specified by:
putLongin classAbstractPositionedByteRange- Parameters:
val- the new value.- Returns:
- this.
-
putVLong
public int putVLong(long val) Description copied from interface:PositionedByteRangeStore the longvalat the next position as a VLong- Specified by:
putVLongin interfacePositionedByteRange- Specified by:
putVLongin classAbstractPositionedByteRange- Parameters:
val- the value to store- Returns:
- number of bytes written
-
put
Description copied from interface:PositionedByteRangeStore the content ofvalin this range, starting at the next position.- Specified by:
putin interfacePositionedByteRange- Specified by:
putin classAbstractPositionedByteRange- Parameters:
val- the new value.- Returns:
- this.
-
put
Description copied from interface:PositionedByteRangeStorelengthbytes fromvalinto this range. Bytes fromvalare copied starting atoffsetinto the range, starting at the current position.- Specified by:
putin interfacePositionedByteRange- Specified by:
putin classAbstractPositionedByteRange- Parameters:
val- the new value.offset- the offset invalfrom which to start copying.length- the number of bytes to copy fromval.- Returns:
- this.
-
get
Description copied from interface:ByteRangeFilldstwith bytes from the range, starting fromindex.- Specified by:
getin interfaceByteRange- Specified by:
getin interfacePositionedByteRange- Overrides:
getin classAbstractPositionedByteRange- Parameters:
index- zero-based index into this range.dst- the destination of the copy.- Returns:
- this.
-
get
Description copied from interface:ByteRangeFilldstwith bytes from the range, starting fromindex.lengthbytes are copied intodst, starting atoffset.- Specified by:
getin interfaceByteRange- Specified by:
getin interfacePositionedByteRange- Overrides:
getin classAbstractPositionedByteRange- Parameters:
index- zero-based index into this range.dst- the destination of the copy.offset- the offset intodstto start the copy.length- the number of bytes to copy intodst.- Returns:
- this.
-
put
Description copied from interface:ByteRangeStorevalatindex.- Specified by:
putin interfaceByteRange- Specified by:
putin interfacePositionedByteRange- Specified by:
putin classAbstractPositionedByteRange- Parameters:
index- the index in the range wherevalis stored.val- the value to store.- Returns:
- this.
-
putShort
Description copied from interface:ByteRangeStore the short value atindex- Specified by:
putShortin interfaceByteRange- Specified by:
putShortin interfacePositionedByteRange- Specified by:
putShortin classAbstractPositionedByteRange- Parameters:
index- the index in the range wherevalis storedval- the value to store- Returns:
- this
-
putInt
Description copied from interface:ByteRangeStore the int value atindex- Specified by:
putIntin interfaceByteRange- Specified by:
putIntin interfacePositionedByteRange- Specified by:
putIntin classAbstractPositionedByteRange- 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 classAbstractPositionedByteRange- Parameters:
index- the index in the range wherevalis storedval- the value to store- Returns:
- number of bytes written
-
putLong
Description copied from interface:ByteRangeStore the long value atindex- Specified by:
putLongin interfaceByteRange- Specified by:
putLongin interfacePositionedByteRange- Specified by:
putLongin classAbstractPositionedByteRange- Parameters:
index- the index in the range wherevalis storedval- the value to store- Returns:
- this
-
put
Description copied from interface:ByteRangeStorevalatindex.- Specified by:
putin interfaceByteRange- Specified by:
putin interfacePositionedByteRange- Specified by:
putin classAbstractPositionedByteRange- 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 interfacePositionedByteRange- Specified by:
putin classAbstractPositionedByteRange- 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.
-
deepCopy
Description copied from interface:ByteRangeCreate a newByteRangewith new backing byte[] containing a copy of the content fromthisrange's window.- Specified by:
deepCopyin interfaceByteRange- Specified by:
deepCopyin interfacePositionedByteRange- Specified by:
deepCopyin classAbstractPositionedByteRange- 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.- Specified by:
shallowCopyin interfaceByteRange- Specified by:
shallowCopyin interfacePositionedByteRange- Specified by:
shallowCopyin classAbstractPositionedByteRange- 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.- Specified by:
shallowCopySubRangein interfaceByteRange- Specified by:
shallowCopySubRangein interfacePositionedByteRange- Specified by:
shallowCopySubRangein classAbstractPositionedByteRange- 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[].
-
setLimit
Description copied from interface:PositionedByteRangeLimits the byte range upto a specified value. Limit cannot be greater than capacity- Specified by:
setLimitin interfacePositionedByteRange- Overrides:
setLimitin classAbstractPositionedByteRange- Returns:
- PositionedByteRange
-
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 interfacePositionedByteRange- Specified by:
unsetin classAbstractPositionedByteRange- Returns:
- this
-