@InterfaceAudience.Private @InterfaceStability.Evolving public abstract class AbstractPositionedByteRange extends AbstractByteRange implements PositionedByteRange
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.| Modifier and Type | Field and Description | 
|---|---|
| protected int | limit | 
| protected int | positionThe current index into the range. | 
bytes, hash, length, offset, UNSET_HASH_VALUE| Constructor and Description | 
|---|
| AbstractPositionedByteRange() | 
| Modifier and Type | Method and Description | 
|---|---|
| byte | get()Retrieve the next byte from this range. | 
| PositionedByteRange | get(byte[] dst)Fill  dstwith bytes from the range, starting fromposition. | 
| PositionedByteRange | get(byte[] dst,
   int offset,
   int length)Fill  dstwith bytes from the range, starting from the currentposition. | 
| PositionedByteRange | get(int index,
   byte[] dst)Fill  dstwith bytes from the range, starting fromindex. | 
| PositionedByteRange | get(int index,
   byte[] dst,
   int offset,
   int length)Fill  dstwith bytes from the range, starting fromindex. | 
| int | getInt()Retrieve the next int value from this range. | 
| int | getLimit()Return the current limit | 
| long | getLong()Retrieve the next long value from this range. | 
| int | getPosition()The current  positionmarker. | 
| int | getRemaining()The number of bytes remaining between position and the end of the range. | 
| short | getShort()Retrieve the next short value from this range. | 
| long | getVLong()Retrieve the next long value, which is stored as VLong, from this range | 
| byte | peek()Retrieve the next byte from this range without incrementing position. | 
| PositionedByteRange | set(byte[] bytes)Reuse this  ByteRangeover a new byte[]. | 
| PositionedByteRange | set(byte[] bytes,
   int offset,
   int length)Reuse this  ByteRangeover a new byte[]. | 
| PositionedByteRange | set(int capacity)Reuse this  ByteRangeover a new byte[]. | 
| PositionedByteRange | setLength(int length)Update the length of this range. | 
| PositionedByteRange | setLimit(int limit)Limits the byte range upto a specified value. | 
| PositionedByteRange | setOffset(int offset)Update the beginning of this range. | 
| PositionedByteRange | setPosition(int position)Update the  positionindex. | 
clearHashCache, compareTo, deepCopySubRangeTo, deepCopyTo, deepCopyToNewArray, equals, get, getBytes, getInt, getLength, getLong, getOffset, getShort, getVLong, getVLongSize, hashCode, isEmpty, isEmpty, isHashCached, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitdeepCopy, put, put, put, put, put, put, putInt, putInt, putLong, putLong, putShort, putShort, putVLong, shallowCopy, shallowCopySubRange, unsetdeepCopySubRangeTo, deepCopyTo, deepCopyToNewArray, get, getBytes, getInt, getLength, getLong, getOffset, getShort, getVLong, isEmpty, putVLongcompareToprotected int position
ByteBuffer position, 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) or AbstractByteRange.hashCode() comparisons.
 
protected int limit
public AbstractPositionedByteRange()
public PositionedByteRange set(int capacity)
ByteRangeByteRange over a new byte[]. offset is set to
 0 and length is set to capacity.set in interface ByteRangeset in interface PositionedByteRangeset in class AbstractByteRangecapacity - the size of a new byte[].public PositionedByteRange set(byte[] bytes)
ByteRangeByteRange over a new byte[]. offset is set to
 0 and length is set to bytes.length. A null bytes
 IS supported, in which case this method will behave equivalently to
 ByteRange.unset().set in interface ByteRangeset in interface PositionedByteRangeset in class AbstractByteRangebytes - the array to wrap.public PositionedByteRange set(byte[] bytes, int offset, int length)
ByteRangeByteRange over a new byte[]. A null bytes IS
 supported, in which case this method will behave equivalently to
 ByteRange.unset(), regardless of the values of offset and
 length.set in interface ByteRangeset in interface PositionedByteRangeset in class AbstractByteRangebytes - The array to wrap.offset - The offset into bytes considered the beginning of
            this range.length - The length of this range.public PositionedByteRange setOffset(int offset)
offset + length may not be
 greater than bytes.length. Resets position to 0.setOffset in interface ByteRangesetOffset in interface PositionedByteRangesetOffset in class AbstractByteRangeoffset - the new start of this range.public PositionedByteRange setLength(int length)
offset + length should not be
 greater than bytes.length. If position is greater than the
 new length, sets position to length.setLength in interface ByteRangesetLength in interface PositionedByteRangesetLength in class AbstractByteRangelength - The new length of this range.public int getPosition()
PositionedByteRangeposition marker. This valuae is 0-indexed, relative to
 the beginning of the range.getPosition in interface PositionedByteRangepublic PositionedByteRange setPosition(int position)
PositionedByteRangeposition index. May not be greater than length.setPosition in interface PositionedByteRangeposition - the new position in this range.public int getRemaining()
PositionedByteRangegetRemaining in interface PositionedByteRangepublic byte peek()
PositionedByteRangepeek in interface PositionedByteRangepublic byte get()
PositionedByteRangeget in interface PositionedByteRangepublic PositionedByteRange get(byte[] dst)
PositionedByteRangedst with bytes from the range, starting from position.
 This range's position is incremented by the length of dst,
 the number of bytes copied.get in interface PositionedByteRangedst - the destination of the copy.public PositionedByteRange get(byte[] dst, int offset, int length)
PositionedByteRangedst with bytes from the range, starting from the current
 position. length bytes are copied into dst,
 starting at offset. This range's position is incremented
 by the number of bytes copied.get in interface PositionedByteRangedst - the destination of the copy.offset - the offset into dst to start the copy.length - the number of bytes to copy into dst.public PositionedByteRange get(int index, byte[] dst)
ByteRangedst with bytes from the range, starting from index.get in interface ByteRangeget in interface PositionedByteRangeget in class AbstractByteRangeindex - zero-based index into this range.dst - the destination of the copy.public PositionedByteRange get(int index, byte[] dst, int offset, int length)
ByteRangedst with bytes from the range, starting from index.
 length bytes are copied into dst, starting at offset.get in interface ByteRangeget in interface PositionedByteRangeget in class AbstractByteRangeindex - zero-based index into this range.dst - the destination of the copy.offset - the offset into dst to start the copy.length - the number of bytes to copy into dst.public short getShort()
PositionedByteRangegetShort in interface PositionedByteRangepublic int getInt()
PositionedByteRangegetInt in interface PositionedByteRangepublic long getLong()
PositionedByteRangegetLong in interface PositionedByteRangepublic long getVLong()
PositionedByteRangegetVLong in interface PositionedByteRangepublic PositionedByteRange setLimit(int limit)
PositionedByteRangesetLimit in interface PositionedByteRangepublic int getLimit()
PositionedByteRangegetLimit in interface PositionedByteRangeCopyright © 2007–2021 The Apache Software Foundation. All rights reserved.