@InterfaceAudience.Private public class ByteBufferKeyValue extends ByteBufferCell implements ExtendedCell
ByteBufferCell
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 |
CELL_NOT_BASED_ON_CHUNK
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 |
---|---|
Cell |
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() |
byte |
getFamilyLength() |
int |
getFamilyOffset() |
int |
getFamilyPosition() |
int |
getOffset() |
byte[] |
getQualifierArray()
Contiguous raw bytes that may start at any index in the containing array.
|
ByteBuffer |
getQualifierByteBuffer() |
int |
getQualifierLength() |
int |
getQualifierOffset() |
int |
getQualifierPosition() |
byte[] |
getRowArray()
Contiguous raw bytes that may start at any index in the containing array.
|
ByteBuffer |
getRowByteBuffer() |
short |
getRowLength() |
int |
getRowOffset() |
int |
getRowPosition() |
long |
getSequenceId()
A region-specific unique monotonically increasing sequence ID given to each Cell.
|
int |
getSerializedSize(boolean withTags) |
byte[] |
getTagsArray()
Contiguous raw bytes representing tags that may start at any index in the containing array.
|
ByteBuffer |
getTagsByteBuffer() |
int |
getTagsLength()
HBase internally uses 2 bytes to store tags length in Cell.
|
int |
getTagsOffset() |
int |
getTagsPosition() |
long |
getTimestamp() |
byte |
getTypeByte() |
byte[] |
getValueArray()
Contiguous raw bytes that may start at any index in the containing array.
|
ByteBuffer |
getValueByteBuffer() |
int |
getValueLength() |
int |
getValueOffset() |
int |
getValuePosition() |
int |
hashCode()
In line with
equals(Object) , only uses the key portion, not the value. |
long |
heapSize() |
void |
setSequenceId(long seqId)
Sets with the given seqId.
|
void |
setTimestamp(byte[] ts,
int tsOffset)
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
protected final ByteBuffer buf
protected final int offset
protected final int length
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
getRowArray
in interface Cell
public int getRowOffset()
getRowOffset
in interface Cell
public short getRowLength()
getRowLength
in interface Cell
public byte[] getFamilyArray()
Cell
getFamilyArray
in interface Cell
public int getFamilyOffset()
getFamilyOffset
in interface Cell
public byte getFamilyLength()
getFamilyLength
in interface Cell
public byte[] getQualifierArray()
Cell
getQualifierArray
in interface Cell
public int getQualifierOffset()
getQualifierOffset
in interface Cell
public int getQualifierLength()
getQualifierLength
in interface Cell
public long getTimestamp()
getTimestamp
in interface Cell
public byte getTypeByte()
getTypeByte
in interface Cell
public long getSequenceId()
Cell
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.getSequenceId
in interface Cell
public void setSequenceId(long seqId)
SettableSequenceId
setSequenceId
in interface SettableSequenceId
public byte[] getValueArray()
Cell
getValueArray
in interface Cell
public int getValueOffset()
getValueOffset
in interface Cell
public int getValueLength()
getValueLength
in interface Cell
public byte[] getTagsArray()
Cell
getTagsArray
in interface Cell
public int getTagsOffset()
getTagsOffset
in interface Cell
public int getTagsLength()
Cell
TagUtil.MAX_TAGS_LENGTH
, which is 2 * Short.MAX_VALUE + 1 = 65535.
As a result, the return type is int, because a short is not capable of handling that.
Please note that even if the return type is int, the max tags length is far less than Integer.MAX_VALUE.getTagsLength
in interface Cell
public ByteBuffer getRowByteBuffer()
getRowByteBuffer
in class ByteBufferCell
ByteBuffer
containing the row bytes.public int getRowPosition()
getRowPosition
in class ByteBufferCell
ByteBuffer
where row bytes startpublic ByteBuffer getFamilyByteBuffer()
getFamilyByteBuffer
in class ByteBufferCell
ByteBuffer
containing the column family bytes.public int getFamilyPosition()
getFamilyPosition
in class ByteBufferCell
ByteBuffer
where column family bytes startpublic ByteBuffer getQualifierByteBuffer()
getQualifierByteBuffer
in class ByteBufferCell
ByteBuffer
containing the column qualifier bytes.public int getQualifierPosition()
getQualifierPosition
in class ByteBufferCell
ByteBuffer
where column qualifier bytes startpublic ByteBuffer getValueByteBuffer()
getValueByteBuffer
in class ByteBufferCell
ByteBuffer
containing the value bytes.public int getValuePosition()
getValuePosition
in class ByteBufferCell
ByteBuffer
where value bytes startpublic ByteBuffer getTagsByteBuffer()
getTagsByteBuffer
in class ByteBufferCell
ByteBuffer
containing the tag bytes.public int getTagsPosition()
getTagsPosition
in class ByteBufferCell
ByteBuffer
where tag bytes startpublic long 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>
write
in interface ExtendedCell
out
- Stream to which cell has to be writtenwithTags
- Whether to write tags.IOException
public int getSerializedSize(boolean withTags)
getSerializedSize
in interface ExtendedCell
withTags
- Whether to write tags.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>
public void write(ByteBuffer buf, int offset)
ExtendedCell
KeyValue
format.write
in interface ExtendedCell
buf
- The buffer where to write the Cell.offset
- The offset within buffer, to write the Cell.public void setTimestamp(long ts) throws IOException
SettableTimestamp
setTimestamp
in interface SettableTimestamp
IOException
public void setTimestamp(byte[] ts, int tsOffset) throws IOException
SettableTimestamp
setTimestamp
in interface SettableTimestamp
ts
- buffer containing the timestamp valuetsOffset
- offset to the new timestampIOException
public Cell deepClone()
ExtendedCell
deepClone
in interface ExtendedCell
public boolean equals(Object other)
public int hashCode()
equals(Object)
, only uses the key portion, not the value.Copyright © 2007–2017 The Apache Software Foundation. All rights reserved.