org.apache.hadoop.hbase
Class KeyValueUtil

java.lang.Object
  extended by org.apache.hadoop.hbase.KeyValueUtil

@InterfaceAudience.Private
public class KeyValueUtil
extends Object

static convenience methods for dealing with KeyValues and collections of KeyValues


Constructor Summary
KeyValueUtil()
           
 
Method Summary
protected static int appendKeyToByteArrayWithoutValue(Cell cell, byte[] output, int offset)
           
static int appendToByteArray(Cell cell, byte[] output, int offset)
          copy key and value
static void appendToByteBuffer(ByteBuffer bb, KeyValue kv, boolean includeMvccVersion)
           
static ByteBuffer copyKeyToNewByteBuffer(Cell cell)
           
static byte[] copyToNewByteArray(Cell cell)
           
static ByteBuffer copyToNewByteBuffer(Cell cell)
           
static KeyValue copyToNewKeyValue(Cell cell)
          copy key only
static KeyValue createFirstKeyInIncrementedRow(Cell in)
          Increment the row bytes and clear the other fields
static KeyValue createFirstKeyInNextRow(Cell in)
          Append single byte 0x00 to the end of the input row key
static KeyValue ensureKeyValue(Cell cell)
           
protected static int keyLength(Cell cell)
           
static int length(Cell cell)
          length
static int lengthWithMvccVersion(KeyValue kv, boolean includeMvccVersion)
           
static KeyValue nextShallowCopy(ByteBuffer bb, boolean includesMvccVersion)
          Creates a new KeyValue object positioned in the supplied ByteBuffer and sets the ByteBuffer's position to the start of the next KeyValue.
static KeyValue previousKey(KeyValue in)
          Decrement the timestamp.
static int totalLengthWithMvccVersion(Iterable<? extends KeyValue> kvs, boolean includeMvccVersion)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyValueUtil

public KeyValueUtil()
Method Detail

length

public static int length(Cell cell)
length


keyLength

protected static int keyLength(Cell cell)

lengthWithMvccVersion

public static int lengthWithMvccVersion(KeyValue kv,
                                        boolean includeMvccVersion)

totalLengthWithMvccVersion

public static int totalLengthWithMvccVersion(Iterable<? extends KeyValue> kvs,
                                             boolean includeMvccVersion)

copyToNewKeyValue

public static KeyValue copyToNewKeyValue(Cell cell)
copy key only


copyKeyToNewByteBuffer

public static ByteBuffer copyKeyToNewByteBuffer(Cell cell)

copyToNewByteArray

public static byte[] copyToNewByteArray(Cell cell)

appendKeyToByteArrayWithoutValue

protected static int appendKeyToByteArrayWithoutValue(Cell cell,
                                                      byte[] output,
                                                      int offset)

appendToByteArray

public static int appendToByteArray(Cell cell,
                                    byte[] output,
                                    int offset)
copy key and value


copyToNewByteBuffer

public static ByteBuffer copyToNewByteBuffer(Cell cell)

appendToByteBuffer

public static void appendToByteBuffer(ByteBuffer bb,
                                      KeyValue kv,
                                      boolean includeMvccVersion)

nextShallowCopy

public static KeyValue nextShallowCopy(ByteBuffer bb,
                                       boolean includesMvccVersion)
Creates a new KeyValue object positioned in the supplied ByteBuffer and sets the ByteBuffer's position to the start of the next KeyValue. Does not allocate a new array or copy data.


createFirstKeyInNextRow

public static KeyValue createFirstKeyInNextRow(Cell in)
Append single byte 0x00 to the end of the input row key


createFirstKeyInIncrementedRow

public static KeyValue createFirstKeyInIncrementedRow(Cell in)
Increment the row bytes and clear the other fields


previousKey

public static KeyValue previousKey(KeyValue in)
Decrement the timestamp. For tests (currently wasteful) Remember timestamps are sorted reverse chronologically.

Parameters:
in -
Returns:
previous key

ensureKeyValue

public static KeyValue ensureKeyValue(Cell cell)
Parameters:
cell -
Returns:
cell if it is an instance of KeyValue else we will return a new KeyValue instance made from cell


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