@InterfaceAudience.Private public class ByteBufferKeyValue extends ByteBufferExtendedCell
ByteBufferExtendedCell
where the data resides in off
heap/ on heap ByteBufferModifier and Type | Field and Description |
---|---|
protected ByteBuffer |
buf |
static int |
FIXED_OVERHEAD |
protected int |
length |
protected int |
offset |
private long |
seqId |
CELL_NOT_BASED_ON_CHUNK
MAX_TAGS_LENGTH
Constructor and Description |
---|
ByteBufferKeyValue(ByteBuffer buf,
int offset,
int length) |
ByteBufferKeyValue(ByteBuffer buf,
int offset,
int length,
long seqId) |
Modifier and Type | Method and Description |
---|---|
private int |
calculateHashForKey(ByteBufferExtendedCell cell) |
ExtendedCell |
deepClone()
Does a deep copy of the contents to a new memory area and returns it as a new cell.
|
boolean |
equals(Object other)
Needed doing 'contains' on List.
|
ByteBuffer |
getBuffer() |
byte[] |
getFamilyArray()
Contiguous bytes composed of legal HDFS filename characters which may start at any index in the
containing array.
|
ByteBuffer |
getFamilyByteBuffer()
Returns The
ByteBuffer containing the column family bytes. |
byte |
getFamilyLength()
Returns Number of family bytes.
|
(package private) byte |
getFamilyLength(int famLenPos) |
(package private) int |
getFamilyLengthPosition() |
(package private) int |
getFamilyLengthPosition(int rowLength) |
int |
getFamilyOffset()
Returns Array index of first family byte
|
int |
getFamilyPosition()
Returns Position in the
ByteBuffer where column family bytes start |
int |
getFamilyPosition(int familyLengthPosition) |
(package private) int |
getKeyLength() |
int |
getOffset() |
byte[] |
getQualifierArray()
Contiguous raw bytes that may start at any index in the containing array.
|
ByteBuffer |
getQualifierByteBuffer()
Returns The
ByteBuffer containing the column qualifier bytes. |
int |
getQualifierLength()
Returns Number of qualifier bytes.
|
(package private) int |
getQualifierLength(int keyLength,
int rlength,
int flength) |
int |
getQualifierOffset()
Returns Array index of first qualifier byte
|
int |
getQualifierPosition()
Returns Position in the
ByteBuffer where column qualifier bytes start |
(package private) int |
getQualifierPosition(int familyPosition,
int familyLength) |
byte[] |
getRowArray()
Contiguous raw bytes that may start at any index in the containing array.
|
ByteBuffer |
getRowByteBuffer()
Returns The
ByteBuffer containing the row bytes. |
short |
getRowLength()
Returns Number of row bytes.
|
int |
getRowOffset()
Returns Array index of first row byte
|
int |
getRowPosition()
Returns Position in the
ByteBuffer where row bytes start |
long |
getSequenceId()
A region-specific unique monotonically increasing sequence ID given to each Cell.
|
int |
getSerializedSize()
Returns Serialized size (defaults to include tag length).
|
int |
getSerializedSize(boolean withTags)
KeyValue format
<4 bytes keylength> <4 bytes valuelength> <2 bytes rowlength>
<row> <1 byte columnfamilylength> <columnfamily> <columnqualifier>
<8 bytes timestamp> <1 byte keytype> <value> <2 bytes tagslength>
<tags> |
byte[] |
getTagsArray()
Contiguous raw bytes representing tags that may start at any index in the containing array.
|
ByteBuffer |
getTagsByteBuffer()
Returns The
ByteBuffer containing the tag bytes. |
int |
getTagsLength()
HBase internally uses 2 bytes to store tags length in Cell.
|
int |
getTagsOffset()
Returns the first offset where the tags start in the Cell
|
int |
getTagsPosition()
Returns Position in the
ByteBuffer where tag bytes start |
long |
getTimestamp()
Return a long value representing time at which this cell was "Put" into the row.
|
(package private) long |
getTimestamp(int keyLength) |
private int |
getTimestampOffset() |
private int |
getTimestampOffset(int keyLen) |
byte |
getTypeByte()
Returns The byte representation of the KeyValue.TYPE of this cell: one of Put, Delete, etc
|
(package private) byte |
getTypeByte(int keyLen) |
byte[] |
getValueArray()
Contiguous raw bytes that may start at any index in the containing array.
|
ByteBuffer |
getValueByteBuffer()
Returns The
ByteBuffer containing the value bytes. |
int |
getValueLength()
Returns Number of value bytes.
|
int |
getValueOffset()
Returns Array index of first value byte
|
int |
getValuePosition()
Returns Position in the
ByteBuffer where value bytes start |
int |
hashCode()
In line with
equals(Object) , only uses the key portion, not the value. |
long |
heapSize()
Return the approximate 'exclusive deep size' of implementing object.
|
void |
setSequenceId(long seqId)
Sets with the given seqId.
|
void |
setTimestamp(byte[] ts)
Sets with the given timestamp.
|
void |
setTimestamp(long ts)
Sets with the given timestamp.
|
String |
toString() |
void |
write(ByteBuffer buf,
int offset)
Write this Cell into the given buf's offset in a
KeyValue format. |
int |
write(OutputStream out,
boolean withTags)
Write this cell to an OutputStream in a
KeyValue format. |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getChunkId
checkForTagsLength, cloneTags, createCell, getTag, getTags
protected final ByteBuffer buf
protected final int offset
protected final int length
private long seqId
public static final int FIXED_OVERHEAD
public ByteBufferKeyValue(ByteBuffer buf, int offset, int length, long seqId)
public ByteBufferKeyValue(ByteBuffer buf, int offset, int length)
public ByteBuffer getBuffer()
public int getOffset()
public byte[] getRowArray()
Cell
public int getRowOffset()
Cell
public short getRowLength()
Cell
public byte[] getFamilyArray()
Cell
public int getFamilyOffset()
Cell
public byte getFamilyLength()
Cell
int getFamilyLengthPosition()
int getFamilyLengthPosition(int rowLength)
byte getFamilyLength(int famLenPos)
public byte[] getQualifierArray()
Cell
public int getQualifierOffset()
Cell
public int getQualifierLength()
Cell
int getQualifierLength(int keyLength, int rlength, int flength)
public long getTimestamp()
Cell
long getTimestamp(int keyLength)
int getKeyLength()
private int getTimestampOffset(int keyLen)
public byte getTypeByte()
ExtendedCell
byte getTypeByte(int keyLen)
public long getSequenceId()
ExtendedCell
HConstants.KEEP_SEQID_PERIOD
days, but generally becomes irrelevant after the cell's
row is no longer involved in any operations that require strict consistency.public void setSequenceId(long seqId)
ExtendedCell
seqId
- sequence IDpublic byte[] getValueArray()
Cell
public int getValueOffset()
Cell
public int getValueLength()
Cell
public byte[] getTagsArray()
ExtendedCell
public int getTagsOffset()
ExtendedCell
public int getTagsLength()
ExtendedCell
public ByteBuffer getRowByteBuffer()
ByteBufferExtendedCell
ByteBuffer
containing the row bytes.getRowByteBuffer
in class ByteBufferExtendedCell
public int getRowPosition()
ByteBufferExtendedCell
ByteBuffer
where row bytes startgetRowPosition
in class ByteBufferExtendedCell
public ByteBuffer getFamilyByteBuffer()
ByteBufferExtendedCell
ByteBuffer
containing the column family bytes.getFamilyByteBuffer
in class ByteBufferExtendedCell
public int getFamilyPosition()
ByteBufferExtendedCell
ByteBuffer
where column family bytes startgetFamilyPosition
in class ByteBufferExtendedCell
public int getFamilyPosition(int familyLengthPosition)
public ByteBuffer getQualifierByteBuffer()
ByteBufferExtendedCell
ByteBuffer
containing the column qualifier bytes.getQualifierByteBuffer
in class ByteBufferExtendedCell
public int getQualifierPosition()
ByteBufferExtendedCell
ByteBuffer
where column qualifier bytes startgetQualifierPosition
in class ByteBufferExtendedCell
int getQualifierPosition(int familyPosition, int familyLength)
public ByteBuffer getValueByteBuffer()
ByteBufferExtendedCell
ByteBuffer
containing the value bytes.getValueByteBuffer
in class ByteBufferExtendedCell
public int getValuePosition()
ByteBufferExtendedCell
ByteBuffer
where value bytes startgetValuePosition
in class ByteBufferExtendedCell
public ByteBuffer getTagsByteBuffer()
ByteBufferExtendedCell
ByteBuffer
containing the tag bytes.getTagsByteBuffer
in class ByteBufferExtendedCell
public int getTagsPosition()
ByteBufferExtendedCell
ByteBuffer
where tag bytes startgetTagsPosition
in class ByteBufferExtendedCell
public long heapSize()
HeapSize
public int write(OutputStream out, boolean withTags) throws IOException
ExtendedCell
KeyValue
format. <4 bytes keylength> <4 bytes valuelength> <2 bytes rowlength>
<row> <1 byte columnfamilylength> <columnfamily> <columnqualifier>
<8 bytes timestamp> <1 byte keytype> <value> <2 bytes tagslength>
<tags>
out
- Stream to which cell has to be writtenwithTags
- Whether to write tags.IOException
public int getSerializedSize(boolean withTags)
ExtendedCell
<4 bytes keylength> <4 bytes valuelength> <2 bytes rowlength>
<row> <1 byte columnfamilylength> <columnfamily> <columnqualifier>
<8 bytes timestamp> <1 byte keytype> <value> <2 bytes tagslength>
<tags>
withTags
- Whether to write tags.KeyValue
format.public int getSerializedSize()
ExtendedCell
public void write(ByteBuffer buf, int offset)
ExtendedCell
KeyValue
format.buf
- The buffer where to write the Cell.offset
- The offset within buffer, to write the Cell.public void setTimestamp(long ts) throws IOException
ExtendedCell
ts
- timestampIOException
private int getTimestampOffset()
public void setTimestamp(byte[] ts) throws IOException
ExtendedCell
ts
- buffer containing the timestamp valueIOException
public ExtendedCell deepClone()
ExtendedCell
public boolean equals(Object other)
public int hashCode()
equals(Object)
, only uses the key portion, not the value.private int calculateHashForKey(ByteBufferExtendedCell cell)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.