org.apache.hadoop.hbase
Class KeyValue

java.lang.Object
  extended by org.apache.hadoop.hbase.KeyValue
All Implemented Interfaces:
Cloneable, Cell, HeapSize
Direct Known Subclasses:
NoTagsKeyValue

@InterfaceAudience.Private
public class KeyValue
extends Object
implements Cell, HeapSize, Cloneable

An HBase Key/Value. This is the fundamental HBase Type.

HBase applications and users should use the Cell interface and avoid directly using KeyValue and member functions not defined in Cell.

If being used client-side, the primary methods to access individual fields are getRow(), getFamily(), getQualifier(), getTimestamp(), and getValue(). These methods allocate new byte arrays and return copies. Avoid their use server-side.

Instances of this class are immutable. They do not implement Comparable but Comparators are provided. Comparators change with context, whether user table or a catalog table comparison. Its critical you use the appropriate comparator. There are Comparators for normal HFiles, Meta's Hfiles, and bloom filter keys.

KeyValue wraps a byte array and takes offsets and lengths into passed array at where to start interpreting the content as KeyValue. The KeyValue format inside a byte array is: <keylength> <valuelength> <key> <value> Key is further decomposed as: <rowlength> <row> <columnfamilylength> <columnfamily> <columnqualifier> <timestamp> <keytype> The rowlength maximum is Short.MAX_SIZE, column family length maximum is Byte.MAX_SIZE, and column qualifier + key length must be < Integer.MAX_SIZE. The column does not contain the family/qualifier delimiter, COLUMN_FAMILY_DELIMITER
KeyValue can optionally contain Tags. When it contains tags, it is added in the byte array after the value part. The format for this part is: <tagslength><tagsbytes>. tagslength maximum is Short.MAX_SIZE. The tagsbytes contain one or more tags where as each tag is of the form <taglength><tagtype><tagbytes>. tagtype is one byte and taglength maximum is Short.MAX_SIZE and it includes 1 byte type length and actual tag bytes length.


Nested Class Summary
static class KeyValue.KVComparator
          Compare KeyValues.
static class KeyValue.MetaComparator
          A KeyValue.KVComparator for hbase:meta catalog table KeyValues.
static class KeyValue.RawBytesComparator
          This is a TEST only Comparator used in TestSeekTo and TestReseekTo.
static class KeyValue.RowOnlyComparator
          Comparator that compares row component only of a KeyValue.
static interface KeyValue.SamePrefixComparator<T>
          Avoids redundant comparisons for better performance.
static class KeyValue.Type
          Key type.
 
Field Summary
static byte[] COLUMN_FAMILY_DELIM_ARRAY
           
static char COLUMN_FAMILY_DELIMITER
          Colon character in UTF-8
static KeyValue.KVComparator COMPARATOR
          Comparator for plain key/values; i.e.
static int FAMILY_LENGTH_SIZE
          Size of the family length field in bytes
static int KEY_INFRASTRUCTURE_SIZE
           
static int KEY_LENGTH_SIZE
          Size of the key length field in bytes
static int KEYVALUE_INFRASTRUCTURE_SIZE
           
static int KEYVALUE_WITH_TAGS_INFRASTRUCTURE_SIZE
           
static KeyValue LOWESTKEY
          Lowest possible key.
static KeyValue.KVComparator META_COMPARATOR
          A KeyValue.KVComparator for hbase:meta catalog table KeyValues.
static KeyValue.KVComparator RAW_COMPARATOR
          Needed for Bloom Filters.
static int ROW_LENGTH_SIZE
          Size of the row length field in bytes
static int ROW_OFFSET
           
static int TAGS_LENGTH_SIZE
          Size of the tags length field in bytes
static int TIMESTAMP_SIZE
          Size of the timestamp field in bytes
static int TIMESTAMP_TYPE_SIZE
           
static int TYPE_SIZE
          Size of the key type field in bytes
 
Constructor Summary
KeyValue()
          Writable Constructor -- DO NOT USE
KeyValue(byte[] bytes)
          Creates a KeyValue from the start of the specified byte array.
KeyValue(byte[] row, byte[] family, byte[] qualifier)
          Constructs KeyValue structure filled with null value.
KeyValue(byte[] row, byte[] family, byte[] qualifier, byte[] value)
          Constructs KeyValue structure filled with null value.
KeyValue(byte[] row, byte[] family, byte[] qualifier, int qoffset, int qlength, long timestamp, KeyValue.Type type, byte[] value, int voffset, int vlength, byte[] tags)
           
KeyValue(byte[] row, byte[] family, byte[] qualifier, int qoffset, int qlength, long timestamp, KeyValue.Type type, byte[] value, int voffset, int vlength, List<Tag> tags)
          Constructs KeyValue structure filled with specified values.
KeyValue(byte[] row, byte[] family, byte[] qualifier, long timestamp, byte[] value)
          Constructs KeyValue structure filled with specified values.
KeyValue(byte[] row, byte[] family, byte[] qualifier, long timestamp, byte[] value, List<Tag> tags)
          Constructs KeyValue structure filled with specified values.
KeyValue(byte[] row, byte[] family, byte[] qualifier, long timestamp, byte[] value, Tag[] tags)
          Constructs KeyValue structure filled with specified values.
KeyValue(byte[] row, byte[] family, byte[] qualifier, long timestamp, KeyValue.Type type)
          Constructs KeyValue structure filled with specified values.
KeyValue(byte[] row, byte[] family, byte[] qualifier, long timestamp, KeyValue.Type type, byte[] value)
          Constructs KeyValue structure filled with specified values.
KeyValue(byte[] row, byte[] family, byte[] qualifier, long timestamp, KeyValue.Type type, byte[] value, byte[] tags)
          Constructs KeyValue structure filled with specified values.
KeyValue(byte[] row, byte[] family, byte[] qualifier, long timestamp, KeyValue.Type type, byte[] value, List<Tag> tags)
          Constructs KeyValue structure filled with specified values.
KeyValue(byte[] bytes, int offset)
          Creates a KeyValue from the specified byte array and offset.
KeyValue(byte[] buffer, int boffset, byte[] row, int roffset, int rlength, byte[] family, int foffset, int flength, byte[] qualifier, int qoffset, int qlength, long timestamp, KeyValue.Type type, byte[] value, int voffset, int vlength, Tag[] tags)
          Constructs KeyValue structure filled with specified values.
KeyValue(byte[] bytes, int offset, int length)
          Creates a KeyValue from the specified byte array, starting at offset, and for length length.
KeyValue(byte[] row, int roffset, int rlength, byte[] family, int foffset, int flength, byte[] qualifier, int qoffset, int qlength, long timestamp, KeyValue.Type type, byte[] value, int voffset, int vlength)
          Constructs KeyValue structure filled with specified values.
KeyValue(byte[] row, int roffset, int rlength, byte[] family, int foffset, int flength, byte[] qualifier, int qoffset, int qlength, long timestamp, KeyValue.Type type, byte[] value, int voffset, int vlength, byte[] tags, int tagsOffset, int tagsLength)
           
KeyValue(byte[] row, int roffset, int rlength, byte[] family, int foffset, int flength, byte[] qualifier, int qoffset, int qlength, long timestamp, KeyValue.Type type, byte[] value, int voffset, int vlength, List<Tag> tags)
          Constructs KeyValue structure filled with specified values.
KeyValue(byte[] row, int roffset, int rlength, byte[] family, int foffset, int flength, ByteBuffer qualifier, long ts, KeyValue.Type type, ByteBuffer value, List<Tag> tags)
           
KeyValue(byte[] bytes, int offset, int length, long ts)
          Creates a KeyValue from the specified byte array, starting at offset, and for length length.
KeyValue(byte[] row, long timestamp)
          Constructs KeyValue structure filled with null value.
KeyValue(byte[] row, long timestamp, KeyValue.Type type)
          Constructs KeyValue structure filled with null value.
KeyValue(Cell c)
           
KeyValue(int rlength, int flength, int qlength, long timestamp, KeyValue.Type type, int vlength)
          Constructs an empty KeyValue structure, with specified sizes.
KeyValue(int rlength, int flength, int qlength, long timestamp, KeyValue.Type type, int vlength, int tagsLength)
          Constructs an empty KeyValue structure, with specified sizes.
 
Method Summary
 KeyValue clone()
          Clones a KeyValue.
static KeyValue cloneAndAddTags(Cell c, List<Tag> newTags)
          Create a new KeyValue by copying existing cell and adding new tags
static KeyValue create(DataInput in)
           
static KeyValue create(int length, DataInput in)
          Create a KeyValue reading length from in
static KeyValue createFirstDeleteFamilyOnRow(byte[] row, byte[] family)
          Create a Delete Family KeyValue for the specified row and family that would be smaller than all other possible Delete Family KeyValues that have the same row and family.
static KeyValue createFirstOnRow(byte[] row)
          Create a KeyValue that is smaller than all other possible KeyValues for the given row.
static KeyValue createFirstOnRow(byte[] row, byte[] family, byte[] qualifier)
          Create a KeyValue for the specified row, family and qualifier that would be smaller than all other possible KeyValues that have the same row,family,qualifier.
static KeyValue createFirstOnRow(byte[] buffer, byte[] row, byte[] family, byte[] qualifier)
          Create a KeyValue for the specified row, family and qualifier that would be smaller than all other possible KeyValues that have the same row, family, qualifier.
static KeyValue createFirstOnRow(byte[] row, byte[] f, byte[] q, long ts)
           
static KeyValue createFirstOnRow(byte[] buffer, int boffset, byte[] row, int roffset, int rlength, byte[] family, int foffset, int flength, byte[] qualifier, int qoffset, int qlength)
          Create a KeyValue for the specified row, family and qualifier that would be smaller than all other possible KeyValues that have the same row, family, qualifier.
static KeyValue createFirstOnRow(byte[] row, int roffset, int rlength, byte[] family, int foffset, int flength, byte[] qualifier, int qoffset, int qlength)
          Create a KeyValue for the specified row, family and qualifier that would be smaller than all other possible KeyValues that have the same row, family, qualifier.
static KeyValue createFirstOnRow(byte[] row, int roffset, short rlength)
          Create a KeyValue that is smaller than all other possible KeyValues for the given row.
static KeyValue createFirstOnRow(byte[] row, long ts)
          Creates a KeyValue that is smaller than all other KeyValues that are older than the passed timestamp.
 KeyValue createFirstOnRowColTS(long ts)
          Creates the first KV with the row/family/qualifier of this KV and the given timestamp.
 KeyValue createKeyOnly(boolean lenAsVal)
          Creates a new KeyValue that only contains the key portion (the value is set to be null).
static KeyValue createKeyValueFromKey(byte[] b)
           
static KeyValue createKeyValueFromKey(byte[] b, int o, int l)
           
static KeyValue createKeyValueFromKey(ByteBuffer bb)
           
static KeyValue createLastOnRow(byte[] row)
          Creates a KeyValue that is last on the specified row id.
static KeyValue createLastOnRow(byte[] row, int roffset, int rlength, byte[] family, int foffset, int flength, byte[] qualifier, int qoffset, int qlength)
          Create a KeyValue for the specified row, family and qualifier that would be larger than or equal to all other possible KeyValues that have the same row, family, qualifier.
 KeyValue createLastOnRowCol()
          Similar to createLastOnRow(byte[], int, int, byte[], int, int, byte[], int, int) but creates the last key on the row/column of this KV (the value part of the returned KV is always empty).
 boolean equals(Object other)
          Needed doing 'contains' on List.
 byte[] getBuffer()
          Deprecated. Since 0.98.0. Use Cell Interface instead. Do not presume single backing buffer.
static int getDelimiter(byte[] b, int offset, int length, int delimiter)
           
static int getDelimiterInReverse(byte[] b, int offset, int length, int delimiter)
          Find index of passed delimiter walking from end of buffer backwards.
 byte[] getFamily()
          Deprecated. 
 byte[] getFamilyArray()
          Contiguous bytes composed of legal HDFS filename characters which may start at any index in the containing array.
 byte getFamilyLength()
           
 byte getFamilyLength(int foffset)
           
 int getFamilyOffset()
           
 byte[] getKey()
          Do not use unless you have to.
static long getKeyDataStructureSize(int rlength, int flength, int qlength)
          Computes the number of bytes that a KeyValue instance with the provided characteristics would take up in its underlying data structure for the key.
 int getKeyLength()
           
 int getKeyOffset()
           
 String getKeyString()
           
static long getKeyValueDataStructureSize(int klength, int vlength, int tagsLength)
          Computes the number of bytes that a KeyValue instance with the provided characteristics would take up for its underlying data structure.
static long getKeyValueDataStructureSize(int rlength, int flength, int qlength, int vlength)
          Computes the number of bytes that a KeyValue instance with the provided characteristics would take up for its underlying data structure.
static long getKeyValueDataStructureSize(int rlength, int flength, int qlength, int vlength, int tagsLength)
          Computes the number of bytes that a KeyValue instance with the provided characteristics would take up for its underlying data structure.
 int getLength()
           
 long getMvccVersion()
          Here be dragons
 int getOffset()
           
 byte[] getQualifier()
          Deprecated. 
 byte[] getQualifierArray()
          Contiguous raw bytes that may start at any index in the containing array.
 int getQualifierLength()
           
 int getQualifierOffset()
           
 byte[] getRow()
          Deprecated. 
 byte[] getRowArray()
          Contiguous raw bytes that may start at any index in the containing array.
 short getRowLength()
           
 int getRowOffset()
           
 List<Tag> getTags()
          Returns any tags embedded in the KeyValue.
 byte[] getTagsArray()
           
 short getTagsLength()
          Deprecated. 
 int getTagsLengthUnsigned()
          Deprecated. 
 int getTagsOffset()
          This returns the offset where the tag actually starts.
 long getTimestamp()
           
 int getTimestampOffset()
           
 byte getType()
          Deprecated. 
 byte getTypeByte()
           
 byte[] getValue()
          Deprecated. 
 byte[] getValueArray()
          Contiguous raw bytes that may start at any index in the containing array.
 int getValueLength()
           
 int getValueOffset()
           
 int hashCode()
          In line with equals(Object), only uses the key portion, not the value.
 long heapSize()
          HeapSize implementation We do not count the bytes in the rowCache because it should be empty for a KeyValue in the MemStore.
 long heapSizeWithoutTags()
          Deprecated. 
static String humanReadableTimestamp(long timestamp)
           
static KeyValue iscreate(InputStream in)
          Create a KeyValue reading from the raw InputStream.
 boolean isDelete()
          Deprecated. 
static boolean isDelete(byte t)
           
 boolean isDeleteColumnOrFamily()
           
 boolean isDeleteFamily()
           
 boolean isDeleteFamilyVersion()
           
 boolean isDeleteType()
           
 boolean isLatestTimestamp()
           
static String keyToString(byte[] k)
           
static String keyToString(byte[] b, int o, int l)
          Use for logging.
static byte[] makeColumn(byte[] family, byte[] qualifier)
          Makes a column in family:qualifier form from separate byte arrays.
 boolean matchingColumn(byte[] family, byte[] qualifier)
           
 boolean matchingColumn(byte[] family, int foffset, int flength, byte[] qualifier, int qoffset, int qlength)
          Checks if column matches.
 boolean matchingFamily(byte[] family)
           
 boolean matchingQualifier(byte[] qualifier)
           
 boolean matchingQualifier(byte[] qualifier, int offset, int length)
           
 boolean matchingQualifier(KeyValue other)
           
 boolean matchingRow(byte[] row)
           
 boolean matchingRow(byte[] row, int offset, int length)
           
 boolean matchingRow(KeyValue other)
           
static long oswrite(KeyValue kv, OutputStream out)
          Deprecated. 
static long oswrite(KeyValue kv, OutputStream out, boolean withTags)
          Write out a KeyValue in the manner in which we used to when KeyValue was a Writable but do not require a DataOutput, just take plain OutputStream Named oswrite so does not clash with write(KeyValue, DataOutput)
static byte[][] parseColumn(byte[] c)
          Splits a column in family:qualifier form into separate byte arrays.
 void setMvccVersion(long mvccVersion)
           
 KeyValue shallowCopy()
          Creates a shallow copy of this KeyValue, reusing the data byte buffer.
 String toString()
           
 Map<String,Object> toStringMap()
          Produces a string map for this key/value pair.
 boolean updateLatestStamp(byte[] now)
           
static long write(KeyValue kv, DataOutput out)
          Write out a KeyValue in the manner in which we used to when KeyValue was a Writable.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

COLUMN_FAMILY_DELIMITER

public static final char COLUMN_FAMILY_DELIMITER
Colon character in UTF-8

See Also:
Constant Field Values

COLUMN_FAMILY_DELIM_ARRAY

public static final byte[] COLUMN_FAMILY_DELIM_ARRAY

COMPARATOR

public static final KeyValue.KVComparator COMPARATOR
Comparator for plain key/values; i.e. non-catalog table key/values. Works on Key portion of KeyValue only.


META_COMPARATOR

public static final KeyValue.KVComparator META_COMPARATOR
A KeyValue.KVComparator for hbase:meta catalog table KeyValues.


RAW_COMPARATOR

public static final KeyValue.KVComparator RAW_COMPARATOR
Needed for Bloom Filters.


KEY_LENGTH_SIZE

public static final int KEY_LENGTH_SIZE
Size of the key length field in bytes

See Also:
Constant Field Values

TYPE_SIZE

public static final int TYPE_SIZE
Size of the key type field in bytes

See Also:
Constant Field Values

ROW_LENGTH_SIZE

public static final int ROW_LENGTH_SIZE
Size of the row length field in bytes

See Also:
Constant Field Values

FAMILY_LENGTH_SIZE

public static final int FAMILY_LENGTH_SIZE
Size of the family length field in bytes

See Also:
Constant Field Values

TIMESTAMP_SIZE

public static final int TIMESTAMP_SIZE
Size of the timestamp field in bytes

See Also:
Constant Field Values

TIMESTAMP_TYPE_SIZE

public static final int TIMESTAMP_TYPE_SIZE
See Also:
Constant Field Values

KEY_INFRASTRUCTURE_SIZE

public static final int KEY_INFRASTRUCTURE_SIZE
See Also:
Constant Field Values

ROW_OFFSET

public static final int ROW_OFFSET
See Also:
Constant Field Values

KEYVALUE_INFRASTRUCTURE_SIZE

public static final int KEYVALUE_INFRASTRUCTURE_SIZE
See Also:
Constant Field Values

TAGS_LENGTH_SIZE

public static final int TAGS_LENGTH_SIZE
Size of the tags length field in bytes

See Also:
Constant Field Values

KEYVALUE_WITH_TAGS_INFRASTRUCTURE_SIZE

public static final int KEYVALUE_WITH_TAGS_INFRASTRUCTURE_SIZE
See Also:
Constant Field Values

LOWESTKEY

public static final KeyValue LOWESTKEY
Lowest possible key. Makes a Key with highest possible Timestamp, empty row and column. No key can be equal or lower than this one in memstore or in store file.

Constructor Detail

KeyValue

public KeyValue()
Writable Constructor -- DO NOT USE


KeyValue

public KeyValue(byte[] bytes)
Creates a KeyValue from the start of the specified byte array. Presumes bytes content is formatted as a KeyValue blob.

Parameters:
bytes - byte array

KeyValue

public KeyValue(byte[] bytes,
                int offset)
Creates a KeyValue from the specified byte array and offset. Presumes bytes content starting at offset is formatted as a KeyValue blob.

Parameters:
bytes - byte array
offset - offset to start of KeyValue

KeyValue

public KeyValue(byte[] bytes,
                int offset,
                int length)
Creates a KeyValue from the specified byte array, starting at offset, and for length length.

Parameters:
bytes - byte array
offset - offset to start of the KeyValue
length - length of the KeyValue

KeyValue

public KeyValue(byte[] bytes,
                int offset,
                int length,
                long ts)
Creates a KeyValue from the specified byte array, starting at offset, and for length length.

Parameters:
bytes - byte array
offset - offset to start of the KeyValue
length - length of the KeyValue
ts -

KeyValue

public KeyValue(byte[] row,
                long timestamp)
Constructs KeyValue structure filled with null value. Sets type to KeyValue.Type.Maximum

Parameters:
row - - row key (arbitrary byte array)
timestamp -

KeyValue

public KeyValue(byte[] row,
                long timestamp,
                KeyValue.Type type)
Constructs KeyValue structure filled with null value.

Parameters:
row - - row key (arbitrary byte array)
timestamp -

KeyValue

public KeyValue(byte[] row,
                byte[] family,
                byte[] qualifier)
Constructs KeyValue structure filled with null value. Sets type to KeyValue.Type.Maximum

Parameters:
row - - row key (arbitrary byte array)
family - family name
qualifier - column qualifier

KeyValue

public KeyValue(byte[] row,
                byte[] family,
                byte[] qualifier,
                byte[] value)
Constructs KeyValue structure filled with null value.

Parameters:
row - - row key (arbitrary byte array)
family - family name
qualifier - column qualifier

KeyValue

public KeyValue(byte[] row,
                byte[] family,
                byte[] qualifier,
                long timestamp,
                KeyValue.Type type)
Constructs KeyValue structure filled with specified values.

Parameters:
row - row key
family - family name
qualifier - column qualifier
timestamp - version timestamp
type - key type
Throws:
IllegalArgumentException

KeyValue

public KeyValue(byte[] row,
                byte[] family,
                byte[] qualifier,
                long timestamp,
                byte[] value)
Constructs KeyValue structure filled with specified values.

Parameters:
row - row key
family - family name
qualifier - column qualifier
timestamp - version timestamp
value - column value
Throws:
IllegalArgumentException

KeyValue

public KeyValue(byte[] row,
                byte[] family,
                byte[] qualifier,
                long timestamp,
                byte[] value,
                Tag[] tags)
Constructs KeyValue structure filled with specified values.

Parameters:
row - row key
family - family name
qualifier - column qualifier
timestamp - version timestamp
value - column value
tags - tags
Throws:
IllegalArgumentException

KeyValue

public KeyValue(byte[] row,
                byte[] family,
                byte[] qualifier,
                long timestamp,
                byte[] value,
                List<Tag> tags)
Constructs KeyValue structure filled with specified values.

Parameters:
row - row key
family - family name
qualifier - column qualifier
timestamp - version timestamp
value - column value
tags - tags non-empty list of tags or null
Throws:
IllegalArgumentException

KeyValue

public KeyValue(byte[] row,
                byte[] family,
                byte[] qualifier,
                long timestamp,
                KeyValue.Type type,
                byte[] value)
Constructs KeyValue structure filled with specified values.

Parameters:
row - row key
family - family name
qualifier - column qualifier
timestamp - version timestamp
type - key type
value - column value
Throws:
IllegalArgumentException

KeyValue

public KeyValue(byte[] row,
                byte[] family,
                byte[] qualifier,
                long timestamp,
                KeyValue.Type type,
                byte[] value,
                List<Tag> tags)
Constructs KeyValue structure filled with specified values.

Column is split into two fields, family and qualifier.

Parameters:
row - row key
family - family name
qualifier - column qualifier
timestamp - version timestamp
type - key type
value - column value
Throws:
IllegalArgumentException

KeyValue

public KeyValue(byte[] row,
                byte[] family,
                byte[] qualifier,
                long timestamp,
                KeyValue.Type type,
                byte[] value,
                byte[] tags)
Constructs KeyValue structure filled with specified values.

Parameters:
row - row key
family - family name
qualifier - column qualifier
timestamp - version timestamp
type - key type
value - column value
Throws:
IllegalArgumentException

KeyValue

public KeyValue(byte[] row,
                byte[] family,
                byte[] qualifier,
                int qoffset,
                int qlength,
                long timestamp,
                KeyValue.Type type,
                byte[] value,
                int voffset,
                int vlength,
                List<Tag> tags)
Constructs KeyValue structure filled with specified values.

Parameters:
row - row key
family - family name
qualifier - column qualifier
qoffset - qualifier offset
qlength - qualifier length
timestamp - version timestamp
type - key type
value - column value
voffset - value offset
vlength - value length
Throws:
IllegalArgumentException

KeyValue

public KeyValue(byte[] row,
                byte[] family,
                byte[] qualifier,
                int qoffset,
                int qlength,
                long timestamp,
                KeyValue.Type type,
                byte[] value,
                int voffset,
                int vlength,
                byte[] tags)
Parameters:
row -
family -
qualifier -
qoffset -
qlength -
timestamp -
type -
value -
voffset -
vlength -
tags -

KeyValue

public KeyValue(byte[] row,
                int roffset,
                int rlength,
                byte[] family,
                int foffset,
                int flength,
                byte[] qualifier,
                int qoffset,
                int qlength,
                long timestamp,
                KeyValue.Type type,
                byte[] value,
                int voffset,
                int vlength)
Constructs KeyValue structure filled with specified values.

Column is split into two fields, family and qualifier.

Parameters:
row - row key
Throws:
IllegalArgumentException

KeyValue

public KeyValue(byte[] buffer,
                int boffset,
                byte[] row,
                int roffset,
                int rlength,
                byte[] family,
                int foffset,
                int flength,
                byte[] qualifier,
                int qoffset,
                int qlength,
                long timestamp,
                KeyValue.Type type,
                byte[] value,
                int voffset,
                int vlength,
                Tag[] tags)
Constructs KeyValue structure filled with specified values. Uses the provided buffer as the data buffer.

Column is split into two fields, family and qualifier.

Parameters:
buffer - the bytes buffer to use
boffset - buffer offset
row - row key
roffset - row offset
rlength - row length
family - family name
foffset - family offset
flength - family length
qualifier - column qualifier
qoffset - qualifier offset
qlength - qualifier length
timestamp - version timestamp
type - key type
value - column value
voffset - value offset
vlength - value length
tags - non-empty list of tags or null
Throws:
IllegalArgumentException - an illegal value was passed or there is insufficient space remaining in the buffer

KeyValue

public KeyValue(byte[] row,
                int roffset,
                int rlength,
                byte[] family,
                int foffset,
                int flength,
                byte[] qualifier,
                int qoffset,
                int qlength,
                long timestamp,
                KeyValue.Type type,
                byte[] value,
                int voffset,
                int vlength,
                List<Tag> tags)
Constructs KeyValue structure filled with specified values.

Column is split into two fields, family and qualifier.

Parameters:
row - row key
roffset - row offset
rlength - row length
family - family name
foffset - family offset
flength - family length
qualifier - column qualifier
qoffset - qualifier offset
qlength - qualifier length
timestamp - version timestamp
type - key type
value - column value
voffset - value offset
vlength - value length
tags - tags
Throws:
IllegalArgumentException

KeyValue

public KeyValue(byte[] row,
                int roffset,
                int rlength,
                byte[] family,
                int foffset,
                int flength,
                byte[] qualifier,
                int qoffset,
                int qlength,
                long timestamp,
                KeyValue.Type type,
                byte[] value,
                int voffset,
                int vlength,
                byte[] tags,
                int tagsOffset,
                int tagsLength)
Parameters:
row -
roffset -
rlength -
family -
foffset -
flength -
qualifier -
qoffset -
qlength -
timestamp -
type -
value -
voffset -
vlength -
tags -

KeyValue

public KeyValue(int rlength,
                int flength,
                int qlength,
                long timestamp,
                KeyValue.Type type,
                int vlength)
Constructs an empty KeyValue structure, with specified sizes. This can be used to partially fill up KeyValues.

Column is split into two fields, family and qualifier.

Parameters:
rlength - row length
flength - family length
qlength - qualifier length
timestamp - version timestamp
type - key type
vlength - value length
Throws:
IllegalArgumentException

KeyValue

public KeyValue(int rlength,
                int flength,
                int qlength,
                long timestamp,
                KeyValue.Type type,
                int vlength,
                int tagsLength)
Constructs an empty KeyValue structure, with specified sizes. This can be used to partially fill up KeyValues.

Column is split into two fields, family and qualifier.

Parameters:
rlength - row length
flength - family length
qlength - qualifier length
timestamp - version timestamp
type - key type
vlength - value length
tagsLength -
Throws:
IllegalArgumentException

KeyValue

public KeyValue(byte[] row,
                int roffset,
                int rlength,
                byte[] family,
                int foffset,
                int flength,
                ByteBuffer qualifier,
                long ts,
                KeyValue.Type type,
                ByteBuffer value,
                List<Tag> tags)

KeyValue

public KeyValue(Cell c)
Method Detail

getKeyValueDataStructureSize

public static long getKeyValueDataStructureSize(int rlength,
                                                int flength,
                                                int qlength,
                                                int vlength)
Computes the number of bytes that a KeyValue instance with the provided characteristics would take up for its underlying data structure.

Parameters:
rlength - row length
flength - family length
qlength - qualifier length
vlength - value length
Returns:
the KeyValue data structure length

getKeyValueDataStructureSize

public static long getKeyValueDataStructureSize(int rlength,
                                                int flength,
                                                int qlength,
                                                int vlength,
                                                int tagsLength)
Computes the number of bytes that a KeyValue instance with the provided characteristics would take up for its underlying data structure.

Parameters:
rlength - row length
flength - family length
qlength - qualifier length
vlength - value length
tagsLength - total length of the tags
Returns:
the KeyValue data structure length

getKeyValueDataStructureSize

public static long getKeyValueDataStructureSize(int klength,
                                                int vlength,
                                                int tagsLength)
Computes the number of bytes that a KeyValue instance with the provided characteristics would take up for its underlying data structure.

Parameters:
klength - key length
vlength - value length
tagsLength - total length of the tags
Returns:
the KeyValue data structure length

getKeyDataStructureSize

public static long getKeyDataStructureSize(int rlength,
                                           int flength,
                                           int qlength)
Computes the number of bytes that a KeyValue instance with the provided characteristics would take up in its underlying data structure for the key.

Parameters:
rlength - row length
flength - family length
qlength - qualifier length
Returns:
the key data structure length

isDelete

public static boolean isDelete(byte t)
Returns:
True if a delete type, a KeyValue.Type.Delete or a {KeyValue.Type#DeleteFamily} or a KeyValue.Type.DeleteColumn KeyValue type.

getMvccVersion

public long getMvccVersion()
Here be dragons

Specified by:
getMvccVersion in interface Cell
Returns:
mvccVersion (always >= 0 if exists), or 0 if it no longer exists

setMvccVersion

public void setMvccVersion(long mvccVersion)

equals

public boolean equals(Object other)
Needed doing 'contains' on List. Only compares the key portion, not the value.

Overrides:
equals in class Object

hashCode

public int hashCode()
In line with equals(Object), only uses the key portion, not the value.

Overrides:
hashCode in class Object

clone

public KeyValue clone()
               throws CloneNotSupportedException
Clones a KeyValue. This creates a copy, re-allocating the buffer.

Overrides:
clone in class Object
Returns:
Fully copied clone of this KeyValue
Throws:
CloneNotSupportedException

shallowCopy

public KeyValue shallowCopy()
Creates a shallow copy of this KeyValue, reusing the data byte buffer. http://en.wikipedia.org/wiki/Object_copy

Returns:
Shallow copy of this KeyValue

toString

public String toString()
Overrides:
toString in class Object

keyToString

public static String keyToString(byte[] k)
Parameters:
k - Key portion of a KeyValue.
Returns:
Key as a String, empty string if k is null.

toStringMap

public Map<String,Object> toStringMap()
Produces a string map for this key/value pair. Useful for programmatic use and manipulation of the data stored in an HLogKey, for example, printing as JSON. Values are left out due to their tendency to be large. If needed, they can be added manually.

Returns:
the Map containing data from this key

keyToString

public static String keyToString(byte[] b,
                                 int o,
                                 int l)
Use for logging.

Parameters:
b - Key portion of a KeyValue.
o - Offset to start of key
l - Length of key.
Returns:
Key as a String.

humanReadableTimestamp

public static String humanReadableTimestamp(long timestamp)

getBuffer

@Deprecated
public byte[] getBuffer()
Deprecated. Since 0.98.0. Use Cell Interface instead. Do not presume single backing buffer.

Returns:
The byte array backing this KeyValue.

getOffset

public int getOffset()
Returns:
Offset into getBuffer() at which this KeyValue starts.

getLength

public int getLength()
Returns:
Length of bytes this KeyValue occupies in getBuffer().

getKeyOffset

public int getKeyOffset()
Returns:
Key offset in backing buffer..

getKeyString

public String getKeyString()

getKeyLength

public int getKeyLength()
Returns:
Length of key portion.

getValueArray

public byte[] getValueArray()
Description copied from interface: Cell
Contiguous raw bytes that may start at any index in the containing array. Max length is Integer.MAX_VALUE which is 2,147,483,648 bytes.

Specified by:
getValueArray in interface Cell
Returns:
the backing array of the entire KeyValue (all KeyValue fields are in a single array)

getValueOffset

public int getValueOffset()
Specified by:
getValueOffset in interface Cell
Returns:
the value offset

getValueLength

public int getValueLength()
Specified by:
getValueLength in interface Cell
Returns:
Value length

getRowArray

public byte[] getRowArray()
Description copied from interface: Cell
Contiguous raw bytes that may start at any index in the containing array. Max length is Short.MAX_VALUE which is 32,767 bytes.

Specified by:
getRowArray in interface Cell
Returns:
the backing array of the entire KeyValue (all KeyValue fields are in a single array)

getRowOffset

public int getRowOffset()
Specified by:
getRowOffset in interface Cell
Returns:
Row offset

getRowLength

public short getRowLength()
Specified by:
getRowLength in interface Cell
Returns:
Row length

getFamilyArray

public byte[] getFamilyArray()
Description copied from interface: Cell
Contiguous bytes composed of legal HDFS filename characters which may start at any index in the containing array. Max length is Byte.MAX_VALUE, which is 127 bytes.

Specified by:
getFamilyArray in interface Cell
Returns:
the backing array of the entire KeyValue (all KeyValue fields are in a single array)

getFamilyOffset

public int getFamilyOffset()
Specified by:
getFamilyOffset in interface Cell
Returns:
Family offset

getFamilyLength

public byte getFamilyLength()
Specified by:
getFamilyLength in interface Cell
Returns:
Family length

getFamilyLength

public byte getFamilyLength(int foffset)
Returns:
Family length

getQualifierArray

public byte[] getQualifierArray()
Description copied from interface: Cell
Contiguous raw bytes that may start at any index in the containing array. Max length is Short.MAX_VALUE which is 32,767 bytes.

Specified by:
getQualifierArray in interface Cell
Returns:
the backing array of the entire KeyValue (all KeyValue fields are in a single array)

getQualifierOffset

public int getQualifierOffset()
Specified by:
getQualifierOffset in interface Cell
Returns:
Qualifier offset

getQualifierLength

public int getQualifierLength()
Specified by:
getQualifierLength in interface Cell
Returns:
Qualifier length

getTimestampOffset

public int getTimestampOffset()
Returns:
Timestamp offset

isLatestTimestamp

public boolean isLatestTimestamp()
Returns:
True if this KeyValue has a LATEST_TIMESTAMP timestamp.

updateLatestStamp

public boolean updateLatestStamp(byte[] now)
Parameters:
now - Time to set into this IFF timestamp == HConstants.LATEST_TIMESTAMP (else, its a noop).
Returns:
True is we modified this.

getKey

public byte[] getKey()
Do not use unless you have to. Used internally for compacting and testing. Use getRow(), getFamily(), getQualifier(), and getValue() if accessing a KeyValue client-side.

Returns:
Copy of the key portion only.

getValue

@Deprecated
public byte[] getValue()
Deprecated. 

Returns value in a new byte array. Primarily for use client-side. If server-side, use getBuffer() with appropriate offsets and lengths instead to save on allocations.

Specified by:
getValue in interface Cell
Returns:
Value in a new byte array.

getRow

@Deprecated
public byte[] getRow()
Deprecated. 

Primarily for use client-side. Returns the row of this KeyValue in a new byte array.

If server-side, use getBuffer() with appropriate offsets and lengths instead.

Specified by:
getRow in interface Cell
Returns:
Row in a new byte array.

getTimestamp

public long getTimestamp()
Specified by:
getTimestamp in interface Cell
Returns:
Timestamp

getType

@Deprecated
public byte getType()
Deprecated. 

Returns:
Type of this KeyValue.

getTypeByte

public byte getTypeByte()
Specified by:
getTypeByte in interface Cell
Returns:
KeyValue.TYPE byte representation

isDelete

@Deprecated
public boolean isDelete()
Deprecated. 

Returns:
True if a delete type, a KeyValue.Type.Delete or a {KeyValue.Type#DeleteFamily} or a KeyValue.Type.DeleteColumn KeyValue type.

isDeleteType

public boolean isDeleteType()
Returns:
True if this KV is a KeyValue.Type.Delete type.

isDeleteFamily

public boolean isDeleteFamily()
Returns:
True if this KV is a delete family type.

isDeleteFamilyVersion

public boolean isDeleteFamilyVersion()
Returns:
True if this KV is a delete family-version type.

isDeleteColumnOrFamily

public boolean isDeleteColumnOrFamily()
Returns:
True if this KV is a delete family or column type.

getFamily

@Deprecated
public byte[] getFamily()
Deprecated. 

Primarily for use client-side. Returns the family of this KeyValue in a new byte array.

If server-side, use getBuffer() with appropriate offsets and lengths instead.

Specified by:
getFamily in interface Cell
Returns:
Returns family. Makes a copy.

getQualifier

@Deprecated
public byte[] getQualifier()
Deprecated. 

Primarily for use client-side. Returns the column qualifier of this KeyValue in a new byte array.

If server-side, use getBuffer() with appropriate offsets and lengths instead. Use getBuffer() with appropriate offsets and lengths instead.

Specified by:
getQualifier in interface Cell
Returns:
Returns qualifier. Makes a copy.

getTagsOffset

public int getTagsOffset()
This returns the offset where the tag actually starts.

Specified by:
getTagsOffset in interface Cell
Returns:
the first offset where the tags start in the Cell

getTagsLengthUnsigned

@Deprecated
public int getTagsLengthUnsigned()
Deprecated. 

This returns the total length of the tag bytes

Specified by:
getTagsLengthUnsigned in interface Cell
Returns:
the total length of the tags in the Cell.

getTagsLength

@Deprecated
public short getTagsLength()
Deprecated. 

Specified by:
getTagsLength in interface Cell
Returns:
the total length of the tags in the Cell.

getTags

public List<Tag> getTags()
Returns any tags embedded in the KeyValue. Used in testcases.

Returns:
The tags

getTagsArray

public byte[] getTagsArray()
Specified by:
getTagsArray in interface Cell
Returns:
the backing array of the entire KeyValue (all KeyValue fields are in a single array)

matchingFamily

public boolean matchingFamily(byte[] family)
Parameters:
family -
Returns:
True if matching families.

matchingQualifier

public boolean matchingQualifier(byte[] qualifier)
Parameters:
qualifier -
Returns:
True if matching qualifiers.

matchingQualifier

public boolean matchingQualifier(byte[] qualifier,
                                 int offset,
                                 int length)

matchingQualifier

public boolean matchingQualifier(KeyValue other)

matchingRow

public boolean matchingRow(byte[] row)

matchingRow

public boolean matchingRow(byte[] row,
                           int offset,
                           int length)

matchingRow

public boolean matchingRow(KeyValue other)

matchingColumn

public boolean matchingColumn(byte[] family,
                              byte[] qualifier)
Parameters:
family - column family
qualifier - column qualifier
Returns:
True if column matches

matchingColumn

public boolean matchingColumn(byte[] family,
                              int foffset,
                              int flength,
                              byte[] qualifier,
                              int qoffset,
                              int qlength)
Checks if column matches.

Parameters:
family - family name
foffset - family offset
flength - family length
qualifier - column qualifier
qoffset - qualifier offset
qlength - qualifier length
Returns:
True if column matches

createKeyOnly

public KeyValue createKeyOnly(boolean lenAsVal)
Creates a new KeyValue that only contains the key portion (the value is set to be null). TODO only used by KeyOnlyFilter -- move there.

Parameters:
lenAsVal - replace value with the actual value length (false=empty)

parseColumn

public static byte[][] parseColumn(byte[] c)
Splits a column in family:qualifier form into separate byte arrays. An empty qualifier (ie, fam:) is parsed as { fam, EMPTY_BYTE_ARRAY } while no delimiter (ie, fam) is parsed as an array of one element, { fam }.

Don't forget, HBase DOES support empty qualifiers. (see HBASE-9549)

Not recommend to be used as this is old-style API.

Parameters:
c - The column.
Returns:
The parsed column.

makeColumn

public static byte[] makeColumn(byte[] family,
                                byte[] qualifier)
Makes a column in family:qualifier form from separate byte arrays.

Not recommended for usage as this is old-style API.

Parameters:
family -
qualifier -
Returns:
family:qualifier

getDelimiter

public static int getDelimiter(byte[] b,
                               int offset,
                               int length,
                               int delimiter)
Parameters:
b -
delimiter -
Returns:
Index of delimiter having started from start of b moving rightward.

getDelimiterInReverse

public static int getDelimiterInReverse(byte[] b,
                                        int offset,
                                        int length,
                                        int delimiter)
Find index of passed delimiter walking from end of buffer backwards.

Parameters:
b -
delimiter -
Returns:
Index of delimiter

createLastOnRow

public static KeyValue createLastOnRow(byte[] row)
Creates a KeyValue that is last on the specified row id. That is, every other possible KeyValue for the given row would compareTo() less than the result of this call.

Parameters:
row - row key
Returns:
Last possible KeyValue on passed row

createFirstOnRow

public static KeyValue createFirstOnRow(byte[] row)
Create a KeyValue that is smaller than all other possible KeyValues for the given row. That is any (valid) KeyValue on 'row' would sort _after_ the result.

Parameters:
row - - row key (arbitrary byte array)
Returns:
First possible KeyValue on passed row

createFirstOnRow

public static KeyValue createFirstOnRow(byte[] row,
                                        int roffset,
                                        short rlength)
Create a KeyValue that is smaller than all other possible KeyValues for the given row. That is any (valid) KeyValue on 'row' would sort _after_ the result.

Parameters:
row - - row key (arbitrary byte array)
Returns:
First possible KeyValue on passed row

createFirstOnRow

public static KeyValue createFirstOnRow(byte[] row,
                                        long ts)
Creates a KeyValue that is smaller than all other KeyValues that are older than the passed timestamp.

Parameters:
row - - row key (arbitrary byte array)
ts - - timestamp
Returns:
First possible key on passed row and timestamp.

createFirstOnRow

public static KeyValue createFirstOnRow(byte[] row,
                                        byte[] family,
                                        byte[] qualifier)
Create a KeyValue for the specified row, family and qualifier that would be smaller than all other possible KeyValues that have the same row,family,qualifier. Used for seeking.

Parameters:
row - - row key (arbitrary byte array)
family - - family name
qualifier - - column qualifier
Returns:
First possible key on passed row, and column.

createFirstDeleteFamilyOnRow

public static KeyValue createFirstDeleteFamilyOnRow(byte[] row,
                                                    byte[] family)
Create a Delete Family KeyValue for the specified row and family that would be smaller than all other possible Delete Family KeyValues that have the same row and family. Used for seeking.

Parameters:
row - - row key (arbitrary byte array)
family - - family name
Returns:
First Delete Family possible key on passed row.

createFirstOnRow

public static KeyValue createFirstOnRow(byte[] row,
                                        byte[] f,
                                        byte[] q,
                                        long ts)
Parameters:
row - - row key (arbitrary byte array)
f - - family name
q - - column qualifier
ts - - timestamp
Returns:
First possible key on passed row, column and timestamp

createFirstOnRow

public static KeyValue createFirstOnRow(byte[] row,
                                        int roffset,
                                        int rlength,
                                        byte[] family,
                                        int foffset,
                                        int flength,
                                        byte[] qualifier,
                                        int qoffset,
                                        int qlength)
Create a KeyValue for the specified row, family and qualifier that would be smaller than all other possible KeyValues that have the same row, family, qualifier. Used for seeking.

Parameters:
row - row key
roffset - row offset
rlength - row length
family - family name
foffset - family offset
flength - family length
qualifier - column qualifier
qoffset - qualifier offset
qlength - qualifier length
Returns:
First possible key on passed Row, Family, Qualifier.

createFirstOnRow

public static KeyValue createFirstOnRow(byte[] buffer,
                                        byte[] row,
                                        byte[] family,
                                        byte[] qualifier)
                                 throws IllegalArgumentException
Create a KeyValue for the specified row, family and qualifier that would be smaller than all other possible KeyValues that have the same row, family, qualifier. Used for seeking.

Parameters:
buffer - the buffer to use for the new KeyValue object
row - the value key
family - family name
qualifier - column qualifier
Returns:
First possible key on passed Row, Family, Qualifier.
Throws:
IllegalArgumentException - The resulting KeyValue object would be larger than the provided buffer or than Integer.MAX_VALUE

createFirstOnRow

public static KeyValue createFirstOnRow(byte[] buffer,
                                        int boffset,
                                        byte[] row,
                                        int roffset,
                                        int rlength,
                                        byte[] family,
                                        int foffset,
                                        int flength,
                                        byte[] qualifier,
                                        int qoffset,
                                        int qlength)
                                 throws IllegalArgumentException
Create a KeyValue for the specified row, family and qualifier that would be smaller than all other possible KeyValues that have the same row, family, qualifier. Used for seeking.

Parameters:
buffer - the buffer to use for the new KeyValue object
boffset - buffer offset
row - the value key
roffset - row offset
rlength - row length
family - family name
foffset - family offset
flength - family length
qualifier - column qualifier
qoffset - qualifier offset
qlength - qualifier length
Returns:
First possible key on passed Row, Family, Qualifier.
Throws:
IllegalArgumentException - The resulting KeyValue object would be larger than the provided buffer or than Integer.MAX_VALUE

createLastOnRow

public static KeyValue createLastOnRow(byte[] row,
                                       int roffset,
                                       int rlength,
                                       byte[] family,
                                       int foffset,
                                       int flength,
                                       byte[] qualifier,
                                       int qoffset,
                                       int qlength)
Create a KeyValue for the specified row, family and qualifier that would be larger than or equal to all other possible KeyValues that have the same row, family, qualifier. Used for reseeking.

Parameters:
row - row key
roffset - row offset
rlength - row length
family - family name
foffset - family offset
flength - family length
qualifier - column qualifier
qoffset - qualifier offset
qlength - qualifier length
Returns:
Last possible key on passed row, family, qualifier.

createLastOnRowCol

public KeyValue createLastOnRowCol()
Similar to createLastOnRow(byte[], int, int, byte[], int, int, byte[], int, int) but creates the last key on the row/column of this KV (the value part of the returned KV is always empty). Used in creating "fake keys" for the multi-column Bloom filter optimization to skip the row/column we already know is not in the file.

Returns:
the last key on the row/column of the given key-value pair

createFirstOnRowColTS

public KeyValue createFirstOnRowColTS(long ts)
Creates the first KV with the row/family/qualifier of this KV and the given timestamp. Uses the "maximum" KV type that guarantees that the new KV is the lowest possible for this combination of row, family, qualifier, and timestamp. This KV's own timestamp is ignored. While this function copies the value from this KV, it is normally used on key-only KVs.


createKeyValueFromKey

public static KeyValue createKeyValueFromKey(byte[] b)
Parameters:
b -
Returns:
A KeyValue made of a byte array that holds the key-only part. Needed to convert hfile index members to KeyValues.

createKeyValueFromKey

public static KeyValue createKeyValueFromKey(ByteBuffer bb)
Parameters:
bb -
Returns:
A KeyValue made of a byte buffer that holds the key-only part. Needed to convert hfile index members to KeyValues.

createKeyValueFromKey

public static KeyValue createKeyValueFromKey(byte[] b,
                                             int o,
                                             int l)
Parameters:
b -
o -
l -
Returns:
A KeyValue made of a byte array that holds the key-only part. Needed to convert hfile index members to KeyValues.

create

public static KeyValue create(DataInput in)
                       throws IOException
Parameters:
in - Where to read bytes from. Creates a byte array to hold the KeyValue backing bytes copied from the steam.
Returns:
KeyValue created by deserializing from in OR if we find a length of zero, we will return null which can be useful marking a stream as done.
Throws:
IOException

create

public static KeyValue create(int length,
                              DataInput in)
                       throws IOException
Create a KeyValue reading length from in

Parameters:
length -
in -
Returns:
Created KeyValue OR if we find a length of zero, we will return null which can be useful marking a stream as done.
Throws:
IOException

cloneAndAddTags

public static KeyValue cloneAndAddTags(Cell c,
                                       List<Tag> newTags)
Create a new KeyValue by copying existing cell and adding new tags

Parameters:
c -
newTags -
Returns:
a new KeyValue instance with new tags

iscreate

public static KeyValue iscreate(InputStream in)
                         throws IOException
Create a KeyValue reading from the raw InputStream. Named iscreate so doesn't clash with create(DataInput)

Parameters:
in -
Returns:
Created KeyValue OR if we find a length of zero, we will return null which can be useful marking a stream as done.
Throws:
IOException

write

public static long write(KeyValue kv,
                         DataOutput out)
                  throws IOException
Write out a KeyValue in the manner in which we used to when KeyValue was a Writable.

Parameters:
kv -
out -
Returns:
Length written on stream
Throws:
IOException
See Also:
for the inverse function

oswrite

@Deprecated
public static long oswrite(KeyValue kv,
                                      OutputStream out)
                    throws IOException
Deprecated. 

Write out a KeyValue in the manner in which we used to when KeyValue was a Writable but do not require a DataOutput, just take plain OutputStream Named oswrite so does not clash with write(KeyValue, DataOutput)

Parameters:
kv -
out -
Returns:
Length written on stream
Throws:
IOException
See Also:
for the inverse function, write(KeyValue, DataOutput)

oswrite

public static long oswrite(KeyValue kv,
                           OutputStream out,
                           boolean withTags)
                    throws IOException
Write out a KeyValue in the manner in which we used to when KeyValue was a Writable but do not require a DataOutput, just take plain OutputStream Named oswrite so does not clash with write(KeyValue, DataOutput)

Parameters:
kv -
out -
withTags -
Returns:
Length written on stream
Throws:
IOException
See Also:
for the inverse function, write(KeyValue, DataOutput)

heapSize

public long heapSize()
HeapSize implementation We do not count the bytes in the rowCache because it should be empty for a KeyValue in the MemStore.

Specified by:
heapSize in interface HeapSize
Returns:
Approximate 'exclusive deep size' of implementing object. Includes count of payload and hosting object sizings.

heapSizeWithoutTags

@Deprecated
public long heapSizeWithoutTags()
Deprecated. 

This is a hack that should be removed once we don't care about matching up client- and server-side estimations of cell size. It needed to be backwards compatible with estimations done by older clients. We need to pretend that tags never exist and KeyValues aren't serialized with tag length included. See HBASE-13262 and HBASE-13303



Copyright © 2015 The Apache Software Foundation. All Rights Reserved.