@InterfaceAudience.Public public class SimplePositionedMutableByteRange extends AbstractPositionedByteRange
AbstractPositionedByteRange
implementation with
position support and it is a mutable version. 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.limit, position
bytes, hash, length, offset, UNSET_HASH_VALUE
构造器和说明 |
---|
SimplePositionedMutableByteRange()
Create a new
PositionedByteRange lacking a backing array and with
an undefined viewport. |
SimplePositionedMutableByteRange(byte[] bytes)
Create a new
PositionedByteRange over the provided bytes . |
SimplePositionedMutableByteRange(byte[] bytes,
int offset,
int length)
Create a new
PositionedByteRange over the provided bytes . |
SimplePositionedMutableByteRange(int capacity)
Create a new
PositionedByteRange over a new backing array of size
capacity . |
限定符和类型 | 方法和说明 |
---|---|
PositionedByteRange |
deepCopy()
Create a new
ByteRange with new backing byte[] containing a copy
of the content from this range's window. |
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 . |
PositionedByteRange |
put(byte val)
Store
val at the next position in this range. |
PositionedByteRange |
put(byte[] val)
Store the content of
val in this range, starting at the next position. |
PositionedByteRange |
put(byte[] val,
int offset,
int length)
Store
length bytes from val into this range. |
PositionedByteRange |
put(int index,
byte val)
Store
val at index . |
PositionedByteRange |
put(int index,
byte[] val)
Store
val at index . |
PositionedByteRange |
put(int index,
byte[] val,
int offset,
int length)
Store
length bytes from val into this range, starting at
index . |
PositionedByteRange |
putInt(int val)
Store int
val at the next position in this range. |
PositionedByteRange |
putInt(int index,
int val)
Store the int value at
index |
PositionedByteRange |
putLong(int index,
long val)
Store the long value at
index |
PositionedByteRange |
putLong(long val)
Store long
val at the next position in this range. |
PositionedByteRange |
putShort(int index,
short val)
Store the short value at
index |
PositionedByteRange |
putShort(short val)
Store short
val at the next position in this range. |
int |
putVLong(int index,
long val)
Store the long value at
index as a VLong |
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 |
setOffset(int offset)
Update the beginning of this range.
|
PositionedByteRange |
shallowCopy()
Create a new
ByteRange that points at this range's byte[]. |
PositionedByteRange |
shallowCopySubRange(int innerOffset,
int copyLength)
Create a new
ByteRange that points at this range's byte[]. |
PositionedByteRange |
unset()
Nullifies this ByteRange.
|
get, get, get, getInt, getLimit, getLong, getPosition, getRemaining, getShort, getVLong, peek, setLimit, setPosition
clearHashCache, compareTo, deepCopySubRangeTo, deepCopyTo, deepCopyToNewArray, equals, get, getBytes, getInt, getLength, getLong, getOffset, getShort, getVLong, getVLongSize, hashCode, isEmpty, isEmpty, isHashCached, toString
deepCopySubRangeTo, deepCopyTo, deepCopyToNewArray, get, getBytes, getInt, getLength, getLong, getOffset, getShort, getVLong, isEmpty
compareTo
public SimplePositionedMutableByteRange()
PositionedByteRange
lacking a backing array and with
an undefined viewport.public SimplePositionedMutableByteRange(int capacity)
PositionedByteRange
over a new backing array of size
capacity
. The range's offset and length are 0 and capacity
,
respectively.capacity
- the size of the backing array.public SimplePositionedMutableByteRange(byte[] bytes)
PositionedByteRange
over the provided bytes
.bytes
- The array to wrap.public SimplePositionedMutableByteRange(byte[] bytes, int offset, int length)
PositionedByteRange
over the provided bytes
.bytes
- The array to wrap.offset
- The offset into bytes
considered the beginning of this
range.length
- The length of this range.public PositionedByteRange unset()
ByteRange
unset
在接口中 ByteRange
unset
在接口中 PositionedByteRange
unset
在类中 AbstractPositionedByteRange
public PositionedByteRange set(int capacity)
ByteRange
ByteRange
over a new byte[]. offset
is set to
0 and length
is set to capacity
.set
在接口中 ByteRange
set
在接口中 PositionedByteRange
set
在类中 AbstractPositionedByteRange
capacity
- the size of a new byte[].public PositionedByteRange set(byte[] bytes)
ByteRange
ByteRange
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
在接口中 ByteRange
set
在接口中 PositionedByteRange
set
在类中 AbstractPositionedByteRange
bytes
- the array to wrap.public PositionedByteRange set(byte[] bytes, int offset, int length)
ByteRange
ByteRange
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
在接口中 ByteRange
set
在接口中 PositionedByteRange
set
在类中 AbstractPositionedByteRange
bytes
- 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
在接口中 ByteRange
setOffset
在接口中 PositionedByteRange
setOffset
在类中 AbstractPositionedByteRange
offset
- 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
在接口中 ByteRange
setLength
在接口中 PositionedByteRange
setLength
在类中 AbstractPositionedByteRange
length
- The new length of this range.public PositionedByteRange put(byte val)
PositionedByteRange
val
at the next position in this range.put
在接口中 PositionedByteRange
put
在类中 AbstractPositionedByteRange
val
- the new value.public PositionedByteRange put(byte[] val)
PositionedByteRange
val
in this range, starting at the next position.put
在接口中 PositionedByteRange
put
在类中 AbstractPositionedByteRange
val
- the new value.public PositionedByteRange put(byte[] val, int offset, int length)
PositionedByteRange
length
bytes from val
into this range. Bytes from
val
are copied starting at offset
into the range, starting at
the current position.put
在接口中 PositionedByteRange
put
在类中 AbstractPositionedByteRange
val
- the new value.offset
- the offset in val
from which to start copying.length
- the number of bytes to copy from val
.public PositionedByteRange get(int index, byte[] dst)
ByteRange
dst
with bytes from the range, starting from index
.get
在接口中 ByteRange
get
在接口中 PositionedByteRange
get
在类中 AbstractPositionedByteRange
index
- zero-based index into this range.dst
- the destination of the copy.public PositionedByteRange get(int index, byte[] dst, int offset, int length)
ByteRange
dst
with bytes from the range, starting from index
.
length
bytes are copied into dst
, starting at offset
.get
在接口中 ByteRange
get
在接口中 PositionedByteRange
get
在类中 AbstractPositionedByteRange
index
- 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 PositionedByteRange put(int index, byte val)
ByteRange
val
at index
.put
在接口中 ByteRange
put
在接口中 PositionedByteRange
put
在类中 AbstractPositionedByteRange
index
- the index in the range where val
is stored.val
- the value to store.public PositionedByteRange put(int index, byte[] val)
ByteRange
val
at index
.put
在接口中 ByteRange
put
在接口中 PositionedByteRange
put
在类中 AbstractPositionedByteRange
index
- the index in the range where val
is stored.val
- the value to store.public PositionedByteRange put(int index, byte[] val, int offset, int length)
ByteRange
length
bytes from val
into this range, starting at
index
. Bytes from val
are copied starting at offset
into the range.put
在接口中 ByteRange
put
在接口中 PositionedByteRange
put
在类中 AbstractPositionedByteRange
index
- 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 PositionedByteRange deepCopy()
ByteRange
ByteRange
with new backing byte[] containing a copy
of the content from this
range's window.deepCopy
在接口中 ByteRange
deepCopy
在接口中 PositionedByteRange
deepCopy
在类中 AbstractPositionedByteRange
public PositionedByteRange shallowCopy()
ByteRange
ByteRange
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
在接口中 ByteRange
shallowCopy
在接口中 PositionedByteRange
shallowCopy
在类中 AbstractPositionedByteRange
ByteRange
object referencing this range's byte[].public PositionedByteRange shallowCopySubRange(int innerOffset, int copyLength)
ByteRange
ByteRange
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
在接口中 ByteRange
shallowCopySubRange
在接口中 PositionedByteRange
shallowCopySubRange
在类中 AbstractPositionedByteRange
innerOffset
- 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 putShort(short val)
PositionedByteRange
val
at the next position in this range.putShort
在接口中 PositionedByteRange
putShort
在类中 AbstractPositionedByteRange
val
- the new value.public PositionedByteRange putInt(int val)
PositionedByteRange
val
at the next position in this range.putInt
在接口中 PositionedByteRange
putInt
在类中 AbstractPositionedByteRange
val
- the new value.public PositionedByteRange putLong(long val)
PositionedByteRange
val
at the next position in this range.putLong
在接口中 PositionedByteRange
putLong
在类中 AbstractPositionedByteRange
val
- the new value.public int putVLong(long val)
PositionedByteRange
val
at the next position as a VLongputVLong
在接口中 PositionedByteRange
putVLong
在类中 AbstractPositionedByteRange
val
- the value to storepublic PositionedByteRange putShort(int index, short val)
ByteRange
index
putShort
在接口中 ByteRange
putShort
在接口中 PositionedByteRange
putShort
在类中 AbstractPositionedByteRange
index
- the index in the range where val
is storedval
- the value to storepublic PositionedByteRange putInt(int index, int val)
ByteRange
index
putInt
在接口中 ByteRange
putInt
在接口中 PositionedByteRange
putInt
在类中 AbstractPositionedByteRange
index
- the index in the range where val
is storedval
- the value to storepublic PositionedByteRange putLong(int index, long val)
ByteRange
index
putLong
在接口中 ByteRange
putLong
在接口中 PositionedByteRange
putLong
在类中 AbstractPositionedByteRange
index
- the index in the range where val
is storedval
- the value to storepublic int putVLong(int index, long val)
ByteRange
index
as a VLongputVLong
在接口中 ByteRange
putVLong
在类中 AbstractPositionedByteRange
index
- the index in the range where val
is storedval
- the value to storeCopyright © 2007–2018 The Apache Software Foundation. All rights reserved.