@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
Object.equals(Object). Position is retained by copy operations.| 限定符和类型 | 字段和说明 |
|---|---|
protected int |
limit |
protected int |
position
The current index into the range.
|
bytes, hash, length, offset, UNSET_HASH_VALUE| 构造器和说明 |
|---|
AbstractPositionedByteRange() |
| 限定符和类型 | 方法和说明 |
|---|---|
abstract PositionedByteRange |
deepCopy()
Create a new
ByteRange with new backing byte[] containing a copy
of the content from this range's window. |
byte |
get()
Retrieve the next byte from this range.
|
PositionedByteRange |
get(byte[] dst)
Fill
dst with bytes from the range, starting from position. |
PositionedByteRange |
get(byte[] dst,
int offset,
int length)
Fill
dst with bytes from the range, starting from the current
position. |
PositionedByteRange |
get(int index,
byte[] dst)
Fill
dst with bytes from the range, starting from index. |
PositionedByteRange |
get(int index,
byte[] dst,
int offset,
int length)
Fill
dst with bytes from the range, starting from index. |
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
position marker. |
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.
|
abstract PositionedByteRange |
put(byte val)
Store
val at the next position in this range. |
abstract PositionedByteRange |
put(byte[] val)
Store the content of
val in this range, starting at the next position. |
abstract PositionedByteRange |
put(byte[] val,
int offset,
int length)
Store
length bytes from val into this range. |
abstract PositionedByteRange |
put(int index,
byte val)
Store
val at index. |
abstract PositionedByteRange |
put(int index,
byte[] val)
Store
val at index. |
abstract PositionedByteRange |
put(int index,
byte[] val,
int offset,
int length)
Store
length bytes from val into this range, starting at
index. |
abstract PositionedByteRange |
putInt(int val)
Store int
val at the next position in this range. |
abstract PositionedByteRange |
putInt(int index,
int val)
Store the int value at
index |
abstract PositionedByteRange |
putLong(int index,
long val)
Store the long value at
index |
abstract PositionedByteRange |
putLong(long val)
Store long
val at the next position in this range. |
abstract PositionedByteRange |
putShort(int index,
short val)
Store the short value at
index |
abstract PositionedByteRange |
putShort(short val)
Store short
val at the next position in this range. |
abstract int |
putVLong(int index,
long val)
Store the long value at
index as a VLong |
abstract int |
putVLong(long val)
Store the long
val at the next position as a VLong |
PositionedByteRange |
set(byte[] bytes)
Reuse this
ByteRange over a new byte[]. |
PositionedByteRange |
set(byte[] bytes,
int offset,
int length)
Reuse this
ByteRange over a new byte[]. |
PositionedByteRange |
set(int capacity)
Reuse this
ByteRange over 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
position index. |
abstract PositionedByteRange |
shallowCopy()
Create a new
ByteRange that points at this range's byte[]. |
abstract PositionedByteRange |
shallowCopySubRange(int innerOffset,
int copyLength)
Create a new
ByteRange that points at this range's byte[]. |
abstract PositionedByteRange |
unset()
Nullifies this ByteRange.
|
clearHashCache, compareTo, deepCopySubRangeTo, deepCopyTo, deepCopyToNewArray, get, getBytes, getInt, getLength, getLong, getOffset, getShort, getVLong, getVLongSize, hashCode, isEmpty, isEmpty, isHashCached, toStringdeepCopySubRangeTo, deepCopyTo, deepCopyToNewArray, get, getBytes, getInt, getLength, getLong, getOffset, getShort, getVLong, isEmptycompareToprotected 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
Object.equals(Object) or AbstractByteRange.hashCode() comparisons.
protected int limit
public abstract PositionedByteRange unset()
ByteRangeunset 在接口中 ByteRangeunset 在接口中 PositionedByteRangeunset 在类中 AbstractByteRangepublic PositionedByteRange set(int capacity)
ByteRangeByteRange over a new byte[]. offset is set to
0 and length is set to capacity.set 在接口中 ByteRangeset 在接口中 PositionedByteRangeset 在类中 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 在接口中 ByteRangeset 在接口中 PositionedByteRangeset 在类中 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 在接口中 ByteRangeset 在接口中 PositionedByteRangeset 在类中 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 在接口中 ByteRangesetOffset 在接口中 PositionedByteRangesetOffset 在类中 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 在接口中 ByteRangesetLength 在接口中 PositionedByteRangesetLength 在类中 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 在接口中 PositionedByteRangepublic PositionedByteRange setPosition(int position)
PositionedByteRangeposition index. May not be greater than length.setPosition 在接口中 PositionedByteRangeposition - the new position in this range.public int getRemaining()
PositionedByteRangegetRemaining 在接口中 PositionedByteRangepublic byte peek()
PositionedByteRangepeek 在接口中 PositionedByteRangepublic byte get()
PositionedByteRangeget 在接口中 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 在接口中 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 在接口中 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 abstract PositionedByteRange put(byte val)
PositionedByteRangeval at the next position in this range.put 在接口中 PositionedByteRangeval - the new value.public abstract PositionedByteRange put(byte[] val)
PositionedByteRangeval in this range, starting at the next position.put 在接口中 PositionedByteRangeval - the new value.public abstract PositionedByteRange put(byte[] val, int offset, int length)
PositionedByteRangelength bytes from val into this range. Bytes from
val are copied starting at offset into the range, starting at
the current position.put 在接口中 PositionedByteRangeval - the new value.offset - the offset in val from which to start copying.length - the number of bytes to copy from val.public abstract PositionedByteRange putInt(int index, int val)
ByteRangeindexputInt 在接口中 ByteRangeputInt 在接口中 PositionedByteRangeputInt 在类中 AbstractByteRangeindex - the index in the range where val is storedval - the value to storepublic abstract PositionedByteRange putLong(int index, long val)
ByteRangeindexputLong 在接口中 ByteRangeputLong 在接口中 PositionedByteRangeputLong 在类中 AbstractByteRangeindex - the index in the range where val is storedval - the value to storepublic abstract PositionedByteRange putShort(int index, short val)
ByteRangeindexputShort 在接口中 ByteRangeputShort 在接口中 PositionedByteRangeputShort 在类中 AbstractByteRangeindex - the index in the range where val is storedval - the value to storepublic abstract PositionedByteRange putInt(int val)
PositionedByteRangeval at the next position in this range.putInt 在接口中 PositionedByteRangeval - the new value.public abstract PositionedByteRange putLong(long val)
PositionedByteRangeval at the next position in this range.putLong 在接口中 PositionedByteRangeval - the new value.public abstract PositionedByteRange putShort(short val)
PositionedByteRangeval at the next position in this range.putShort 在接口中 PositionedByteRangeval - the new value.public abstract int putVLong(int index,
long val)
ByteRangeindex as a VLongputVLong 在接口中 ByteRangeputVLong 在类中 AbstractByteRangeindex - the index in the range where val is storedval - the value to storepublic abstract int putVLong(long val)
PositionedByteRangeval at the next position as a VLongputVLong 在接口中 PositionedByteRangeval - the value to storepublic PositionedByteRange get(int index, byte[] dst)
ByteRangedst with bytes from the range, starting from index.get 在接口中 ByteRangeget 在接口中 PositionedByteRangeget 在类中 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 在接口中 ByteRangeget 在接口中 PositionedByteRangeget 在类中 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 在接口中 PositionedByteRangepublic int getInt()
PositionedByteRangegetInt 在接口中 PositionedByteRangepublic long getLong()
PositionedByteRangegetLong 在接口中 PositionedByteRangepublic long getVLong()
PositionedByteRangegetVLong 在接口中 PositionedByteRangepublic abstract PositionedByteRange put(int index, byte val)
ByteRangeval at index.put 在接口中 ByteRangeput 在接口中 PositionedByteRangeput 在类中 AbstractByteRangeindex - the index in the range where val is stored.val - the value to store.public abstract PositionedByteRange put(int index, byte[] val)
ByteRangeval at index.put 在接口中 ByteRangeput 在接口中 PositionedByteRangeput 在类中 AbstractByteRangeindex - the index in the range where val is stored.val - the value to store.public abstract PositionedByteRange put(int index, byte[] val, int offset, int length)
ByteRangelength bytes from val into this range, starting at
index. Bytes from val are copied starting at offset
into the range.put 在接口中 ByteRangeput 在接口中 PositionedByteRangeput 在类中 AbstractByteRangeindex - position in this range to start the copy.val - the value to store.offset - the offset in val from which to start copying.length - the number of bytes to copy from val.public abstract PositionedByteRange deepCopy()
ByteRangeByteRange with new backing byte[] containing a copy
of the content from this range's window.deepCopy 在接口中 ByteRangedeepCopy 在接口中 PositionedByteRangepublic abstract PositionedByteRange shallowCopy()
ByteRangeByteRange 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.shallowCopy 在接口中 ByteRangeshallowCopy 在接口中 PositionedByteRangeByteRange object referencing this range's byte[].public abstract PositionedByteRange shallowCopySubRange(int innerOffset, int copyLength)
ByteRangeByteRange 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.shallowCopySubRange 在接口中 ByteRangeshallowCopySubRange 在接口中 PositionedByteRangeinnerOffset - First byte of clone will be this.offset + copyOffset.copyLength - Number of bytes in the clone.ByteRange object referencing this range's byte[].public PositionedByteRange setLimit(int limit)
PositionedByteRangesetLimit 在接口中 PositionedByteRangepublic int getLimit()
PositionedByteRangegetLimit 在接口中 PositionedByteRangeCopyright © 2007–2021 The Apache Software Foundation. All rights reserved.