Package org.apache.hadoop.hbase.util
Class AbstractPositionedByteRange
java.lang.Object
org.apache.hadoop.hbase.util.AbstractByteRange
org.apache.hadoop.hbase.util.AbstractPositionedByteRange
- All Implemented Interfaces:
Comparable<ByteRange>,ByteRange,PositionedByteRange
- Direct Known Subclasses:
SimplePositionedByteRange,SimplePositionedMutableByteRange
@Private
@Evolving
public abstract class AbstractPositionedByteRange
extends AbstractByteRange
implements PositionedByteRange
Extends the basic
SimpleByteRange implementation with position support. position
is considered transient, not fundamental to the definition of the range, and does not participate
in AbstractByteRange.compareTo(ByteRange), AbstractByteRange.hashCode(), or AbstractByteRange.equals(Object).
Position is retained by copy operations.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intThe current index into the range.Fields inherited from class org.apache.hadoop.hbase.util.AbstractByteRange
bytes, hash, length, offset, UNSET_HASH_VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyteget()Retrieve the next byte from this range.get(byte[] dst) Filldstwith bytes from the range, starting fromposition.get(byte[] dst, int offset, int length) Filldstwith bytes from the range, starting from the currentposition.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.intgetInt()Retrieve the next int value from this range.intgetLimit()Return the current limitlonggetLong()Retrieve the next long value from this range.intThe currentpositionmarker.intThe number of bytes remaining between position and the end of the range.shortgetShort()Retrieve the next short value from this range.longgetVLong()Retrieve the next long value, which is stored as VLong, from this rangebytepeek()Retrieve the next byte from this range without incrementing position.set(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[].setLength(int length) Update the length of this range.setLimit(int limit) Limits the byte range upto a specified value.setOffset(int offset) Update the beginning of this range.setPosition(int position) Update thepositionindex.Methods inherited from class org.apache.hadoop.hbase.util.AbstractByteRange
clearHashCache, compareTo, deepCopySubRangeTo, deepCopyTo, deepCopyToNewArray, equals, get, getBytes, getInt, getLength, getLong, getOffset, getShort, getVLong, getVLongSize, hashCode, isEmpty, isEmpty, isHashCached, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.util.ByteRange
deepCopySubRangeTo, deepCopyTo, deepCopyToNewArray, get, getBytes, getInt, getLength, getLong, getOffset, getShort, getVLong, isEmpty, putVLongMethods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
position
The current index into the range. LikeByteBufferposition, it points to the next value that will be read/written in the array. It provides the appearance of being 0-indexed, even though its value is calculated according to offset.Position is considered transient and does not participate in
AbstractByteRange.equals(Object)orAbstractByteRange.hashCode()comparisons. -
limit
-
-
Constructor Details
-
AbstractPositionedByteRange
public AbstractPositionedByteRange()
-
-
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 classAbstractByteRange- Parameters:
capacity- the size of a new byte[].
-
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 classAbstractByteRange- Parameters:
bytes- the array to wrap.
-
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 classAbstractByteRange- Parameters:
bytes- The array to wrap.offset- The offset intobytesconsidered the beginning of this range.length- The length of this range.- Returns:
- this.
-
setOffset
Update the beginning of this range.offset + lengthmay not be greater thanbytes.length. Resetspositionto 0. the new start of this range.- Specified by:
setOffsetin interfaceByteRange- Specified by:
setOffsetin interfacePositionedByteRange- Overrides:
setOffsetin classAbstractByteRange- Parameters:
offset- the new start of this range.- Returns:
- this.
-
setLength
Update the length of this range.offset + lengthshould not be greater thanbytes.length. Ifpositionis greater than the newlength, setspositiontolength. The new length of this range.- Specified by:
setLengthin interfaceByteRange- Specified by:
setLengthin interfacePositionedByteRange- Overrides:
setLengthin classAbstractByteRange- Parameters:
length- The new length of this range.- Returns:
- this.
-
getPosition
Description copied from interface:PositionedByteRangeThe currentpositionmarker. This valuae is 0-indexed, relative to the beginning of the range.- Specified by:
getPositionin interfacePositionedByteRange
-
setPosition
Description copied from interface:PositionedByteRangeUpdate thepositionindex. May not be greater thanlength.- Specified by:
setPositionin interfacePositionedByteRange- Parameters:
position- the new position in this range.- Returns:
- this.
-
getRemaining
Description copied from interface:PositionedByteRangeThe number of bytes remaining between position and the end of the range.- Specified by:
getRemainingin interfacePositionedByteRange
-
peek
Description copied from interface:PositionedByteRangeRetrieve the next byte from this range without incrementing position.- Specified by:
peekin interfacePositionedByteRange
-
get
Description copied from interface:PositionedByteRangeRetrieve the next byte from this range.- Specified by:
getin interfacePositionedByteRange
-
get
Description copied from interface:PositionedByteRangeFilldstwith bytes from the range, starting fromposition. This range'spositionis incremented by the length ofdst, the number of bytes copied.- Specified by:
getin interfacePositionedByteRange- Parameters:
dst- the destination of the copy.- Returns:
- this.
-
get
Description copied from interface:PositionedByteRangeFilldstwith bytes from the range, starting from the currentposition.lengthbytes are copied intodst, starting atoffset. This range'spositionis incremented by the number of bytes copied.- Specified by:
getin interfacePositionedByteRange- Parameters:
dst- the destination of the copy.offset- the offset intodstto start the copy.length- the number of bytes to copy intodst.- Returns:
- this.
-
get
Description copied from interface:ByteRangeFilldstwith bytes from the range, starting fromindex.- Specified by:
getin interfaceByteRange- Specified by:
getin interfacePositionedByteRange- Overrides:
getin classAbstractByteRange- 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 classAbstractByteRange- 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.
-
getShort
Description copied from interface:PositionedByteRangeRetrieve the next short value from this range.- Specified by:
getShortin interfacePositionedByteRange
-
getInt
Description copied from interface:PositionedByteRangeRetrieve the next int value from this range.- Specified by:
getIntin interfacePositionedByteRange
-
getLong
Description copied from interface:PositionedByteRangeRetrieve the next long value from this range.- Specified by:
getLongin interfacePositionedByteRange
-
getVLong
Description copied from interface:PositionedByteRangeRetrieve the next long value, which is stored as VLong, from this range- Specified by:
getVLongin interfacePositionedByteRange- Returns:
- the long value which is stored as VLong
-
setLimit
Description copied from interface:PositionedByteRangeLimits the byte range upto a specified value. Limit cannot be greater than capacity- Specified by:
setLimitin interfacePositionedByteRange
-
getLimit
Description copied from interface:PositionedByteRangeReturn the current limit- Specified by:
getLimitin interfacePositionedByteRange
-