|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.hbase.util.SimpleByteRange
org.apache.hadoop.hbase.util.SimplePositionedByteRange
@InterfaceAudience.Public @InterfaceStability.Evolving public class SimplePositionedByteRange
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 comparison or copy
operations.
| Field Summary |
|---|
| Fields inherited from class org.apache.hadoop.hbase.util.SimpleByteRange |
|---|
bytes, length, offset |
| Constructor Summary | |
|---|---|
SimplePositionedByteRange()
Create a new PositionedByteRange lacking a backing array and with
an undefined viewport. |
|
SimplePositionedByteRange(byte[] bytes)
Create a new PositionedByteRange over the provided bytes. |
|
SimplePositionedByteRange(byte[] bytes,
int offset,
int length)
Create a new PositionedByteRange over the provided bytes. |
|
SimplePositionedByteRange(int capacity)
Create a new PositionedByteRange over a new backing array of
size capacity. |
|
| Method Summary | |
|---|---|
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 |
getPosition()
The current position marker. |
int |
getRemaining()
The number of bytes remaining between position and the end of the range. |
byte |
peek()
Retrieve the next byte from this range without incrementing position. |
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 |
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 |
setPosition(int position)
Update the position index. |
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. |
| Methods inherited from class org.apache.hadoop.hbase.util.SimpleByteRange |
|---|
clearHashCache, compareTo, deepCopySubRangeTo, deepCopyTo, deepCopyToNewArray, equals, get, getBytes, getLength, getOffset, hashCode, isEmpty, isEmpty, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.hadoop.hbase.util.ByteRange |
|---|
deepCopySubRangeTo, deepCopyTo, deepCopyToNewArray, get, getBytes, getLength, getOffset, isEmpty |
| Methods inherited from interface java.lang.Comparable |
|---|
compareTo |
| Constructor Detail |
|---|
public SimplePositionedByteRange()
PositionedByteRange lacking a backing array and with
an undefined viewport.
public SimplePositionedByteRange(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 SimplePositionedByteRange(byte[] bytes)
PositionedByteRange over the provided bytes.
bytes - The array to wrap.
public SimplePositionedByteRange(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.| Method Detail |
|---|
public PositionedByteRange unset()
ByteRange
unset in interface ByteRangeunset in interface PositionedByteRangeunset in class SimpleByteRangepublic 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 SimpleByteRangecapacity - 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 SimpleByteRangebytes - 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 SimpleByteRangebytes - 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 SimpleByteRangeoffset - 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 SimpleByteRangelength - 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()
PositionedByteRange
getRemaining in interface PositionedByteRangepublic byte peek()
PositionedByteRange
peek in interface PositionedByteRangepublic byte get()
PositionedByteRange
get 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 put(byte val)
PositionedByteRangeval at the next position in this range.
put in interface PositionedByteRangeval - the new value.
public PositionedByteRange put(byte[] val)
PositionedByteRangeval in this range, starting at the next position.
put in interface PositionedByteRangeval - the new value.
public 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 in interface PositionedByteRangeval - 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)
ByteRangedst with bytes from the range, starting from index.
get in interface ByteRangeget in interface PositionedByteRangeget in class SimpleByteRangeindex - 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 SimpleByteRangeindex - 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)
ByteRangeval at index.
put in interface ByteRangeput in interface PositionedByteRangeput in class SimpleByteRangeindex - the index in the range where val is stored.val - the value to store.
public PositionedByteRange put(int index,
byte[] val)
ByteRangeval at index.
put in interface ByteRangeput in interface PositionedByteRangeput in class SimpleByteRangeindex - 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)
ByteRangelength bytes from val into this range, starting at
index. Bytes from val are copied starting at offset
into the range.
put in interface ByteRangeput in interface PositionedByteRangeput in class SimpleByteRangeindex - 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()
ByteRangeByteRange with new backing byte[] containing a copy
of the content from this range's window.
deepCopy in interface ByteRangedeepCopy in interface PositionedByteRangedeepCopy in class SimpleByteRangepublic 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 in interface ByteRangeshallowCopy in interface PositionedByteRangeshallowCopy in class SimpleByteRangeByteRange object referencing this range's byte[].
public 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 in interface ByteRangeshallowCopySubRange in interface PositionedByteRangeshallowCopySubRange in class SimpleByteRangeinnerOffset - First byte of clone will be this.offset + copyOffset.copyLength - Number of bytes in the clone.
ByteRange object referencing this range's byte[].
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||