public class KeyValue extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
KeyValue.KeyComparator
Compare key portion of a
KeyValue. |
static class |
KeyValue.SplitKeyValue
Utility class that splits a KeyValue buffer into separate byte arrays.
|
static class |
KeyValue.Type
Key type.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
FAMILY_LENGTH_SIZE
Size of the family length field in bytes.
|
static KeyValue.KeyComparator |
KEY_COMPARATOR
Comparator for plain key; i.e.
|
static int |
KEY_INFRASTRUCTURE_SIZE |
static int |
KEYVALUE_INFRASTRUCTURE_SIZE |
static long |
LATEST_TIMESTAMP
Timestamp to use when we want to refer to the latest cell.
|
static long |
OLDEST_TIMESTAMP
Timestamp to use when we want to refer to the oldest cell.
|
static int |
ROW_LENGTH_SIZE
Size of the row length field in bytes.
|
static int |
ROW_OFFSET |
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 and Description |
|---|
KeyValue(byte[] bytes)
Creates a KeyValue from the start of the specified byte array.
|
KeyValue(byte[] row,
byte[] family,
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,
byte[] family,
byte[] qualifier,
long timestamp,
byte[] value)
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[] bytes,
int offset)
Creates a KeyValue from the specified byte array and offset.
|
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.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other) |
static KeyValue |
fromKey(byte[] key) |
byte[] |
getBuffer() |
byte[] |
getFamily()
Primarily for use client-side.
|
byte |
getFamilyLength() |
byte |
getFamilyLength(int foffset) |
int |
getFamilyOffset() |
int |
getFamilyOffset(int rlength) |
byte[] |
getKey()
Do not use unless you have to.
|
int |
getKeyLength() |
int |
getKeyOffset() |
int |
getLength() |
int |
getOffset() |
byte[] |
getQualifier()
Primarily for use client-side.
|
int |
getQualifierLength() |
int |
getQualifierLength(int rlength,
int flength) |
int |
getQualifierOffset() |
int |
getQualifierOffset(int foffset) |
byte[] |
getRow()
Primarily for use client-side.
|
short |
getRowLength() |
int |
getRowOffset() |
long |
getTimestamp() |
int |
getTimestampOffset(int keylength) |
byte |
getType() |
byte[] |
getValue()
Returns value in a new byte array.
|
int |
getValueLength() |
int |
getValueOffset() |
int |
hashCode() |
static String |
humanReadableTimestamp(long timestamp) |
static String |
keyToString(byte[] b,
int o,
int l) |
KeyValue.SplitKeyValue |
split() |
String |
toString() |
void |
write(DataOutput out) |
public static final long LATEST_TIMESTAMP
public static final long OLDEST_TIMESTAMP
public static final KeyValue.KeyComparator KEY_COMPARATOR
public static final int TYPE_SIZE
public static final int ROW_LENGTH_SIZE
public static final int FAMILY_LENGTH_SIZE
public static final int TIMESTAMP_SIZE
public static final int TIMESTAMP_TYPE_SIZE
public static final int KEY_INFRASTRUCTURE_SIZE
public static final int ROW_OFFSET
public static final int KEYVALUE_INFRASTRUCTURE_SIZE
public KeyValue(byte[] bytes)
bytes content is formatted as a KeyValue blob.bytes - byte arraypublic KeyValue(byte[] bytes,
int offset)
bytes content starting at offset is
formatted as a KeyValue blob.bytes - byte arrayoffset - offset to start of KeyValuepublic KeyValue(byte[] bytes,
int offset,
int length)
length.bytes - byte arrayoffset - offset to start of the KeyValuelength - length of the KeyValuepublic KeyValue(byte[] row,
byte[] family,
byte[] qualifier,
long timestamp,
KeyValue.Type type)
row - row keyfamily - family namequalifier - column qualifiertimestamp - version timestamptype - key typeIllegalArgumentExceptionpublic KeyValue(byte[] row,
byte[] family,
byte[] qualifier,
long timestamp,
byte[] value)
row - row keyfamily - family namequalifier - column qualifiertimestamp - version timestampvalue - column valueIllegalArgumentExceptionpublic KeyValue(byte[] row,
byte[] family,
byte[] qualifier,
long timestamp,
KeyValue.Type type,
byte[] value)
row - row keyfamily - family namequalifier - column qualifiertimestamp - version timestamptype - key typevalue - column valueIllegalArgumentExceptionpublic KeyValue(byte[] row,
byte[] family,
byte[] qualifier,
int qoffset,
int qlength,
long timestamp,
KeyValue.Type type,
byte[] value,
int voffset,
int vlength)
row - row keyfamily - family namequalifier - column qualifierqoffset - qualifier offsetqlength - qualifier lengthtimestamp - version timestamptype - key typevalue - column valuevoffset - value offsetvlength - value lengthIllegalArgumentExceptionpublic 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)
Column is split into two fields, family and qualifier.
row - row keyroffset - row offsetrlength - row lengthfamily - family namefoffset - family offsetflength - family lengthqualifier - column qualifierqoffset - qualifier offsetqlength - qualifier lengthtimestamp - version timestamptype - key typevalue - column valuevoffset - value offsetvlength - value lengthIllegalArgumentExceptionpublic static String keyToString(byte[] b, int o, int l)
public static String humanReadableTimestamp(long timestamp)
public byte[] getBuffer()
public int getOffset()
getBuffer() at which this KeyValue starts.public int getLength()
getBuffer().public int getKeyOffset()
public int getKeyLength()
public int getValueOffset()
public int getValueLength()
public int getRowOffset()
public short getRowLength()
public int getFamilyOffset()
public int getFamilyOffset(int rlength)
public byte getFamilyLength()
public byte getFamilyLength(int foffset)
public int getQualifierOffset()
public int getQualifierOffset(int foffset)
public int getQualifierLength()
public int getQualifierLength(int rlength,
int flength)
public int getTimestampOffset(int keylength)
keylength - Pass if you have it to save on a int creation.public byte[] getKey()
getRow(), getFamily(), getQualifier(), and
getValue() if accessing a KeyValue client-side.public byte[] getValue()
getBuffer() with appropriate offsets and lengths instead to
save on allocations.public byte[] getRow()
If server-side, use getBuffer() with appropriate offsets and
lengths instead.
public long getTimestamp()
public byte getType()
public byte[] getFamily()
If server-side, use getBuffer() with appropriate offsets and
lengths instead.
public byte[] getQualifier()
If server-side, use getBuffer() with appropriate offsets and
lengths instead.
Use getBuffer() with appropriate offsets and lengths instead.
public KeyValue.SplitKeyValue split()
public void write(DataOutput out) throws IOException
IOExceptionpublic static KeyValue fromKey(byte[] key)
Copyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.