org.apache.hadoop.hbase
Class CellUtil

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

@InterfaceAudience.Public
@InterfaceStability.Evolving
public final class CellUtil
extends Object

Utility methods helpful slinging Cell instances.


Constructor Summary
CellUtil()
           
 
Method Summary
static byte[] cloneFamily(Cell cell)
           
static byte[] cloneQualifier(Cell cell)
           
static byte[] cloneRow(Cell cell)
          get individual arrays for tests
static byte[] cloneValue(Cell cell)
           
static int copyFamilyTo(Cell cell, byte[] destination, int destinationOffset)
           
static int copyQualifierTo(Cell cell, byte[] destination, int destinationOffset)
           
static int copyRowTo(Cell cell, byte[] destination, int destinationOffset)
          copyTo
static int copyTagTo(Cell cell, byte[] destination, int destinationOffset)
          Copies the tags info into the tag portion of the cell
static int copyValueTo(Cell cell, byte[] destination, int destinationOffset)
           
static Cell createCell(byte[] row, byte[] family, byte[] qualifier, long timestamp, byte type, byte[] value)
           
static Cell createCell(byte[] row, byte[] family, byte[] qualifier, long timestamp, byte type, byte[] value, byte[] tags, long memstoreTS)
           
static Cell createCell(byte[] row, byte[] family, byte[] qualifier, long timestamp, byte type, byte[] value, long memstoreTS)
           
static Cell createCell(byte[] row, byte[] family, byte[] qualifier, long timestamp, KeyValue.Type type, byte[] value, byte[] tags)
           
static CellScanner createCellScanner(Cell[] cellArray)
           
static CellScanner createCellScanner(Iterable<Cell> cellIterable)
           
static CellScanner createCellScanner(Iterator<Cell> cells)
           
static CellScanner createCellScanner(List<? extends CellScannable> cellScannerables)
           
static CellScanner createCellScanner(NavigableMap<byte[],List<Cell>> map)
          Flatten the map of cells out under the CellScanner
static int estimatedSizeOf(Cell cell)
           
static ByteRange fillFamilyRange(Cell cell, ByteRange range)
           
static ByteRange fillQualifierRange(Cell cell, ByteRange range)
           
static ByteRange fillRowRange(Cell cell, ByteRange range)
          ByteRange
static ByteRange fillTagRange(Cell cell, ByteRange range)
           
static ByteBuffer getQualifierBufferShallowCopy(Cell cell)
           
static byte getRowByte(Cell cell, int index)
          misc
static byte[] getTagArray(Cell cell)
          Returns tag value in a new byte array.
static ByteBuffer getValueBufferShallowCopy(Cell cell)
           
static boolean isDelete(Cell cell)
           
static boolean isDeleteColumns(Cell cell)
           
static boolean isDeleteColumnVersion(Cell cell)
           
static boolean isDeleteFamily(Cell cell)
           
static boolean matchingColumn(Cell left, byte[] fam, byte[] qual)
           
static boolean matchingColumn(Cell left, Cell right)
           
static boolean matchingFamily(Cell left, byte[] buf)
           
static boolean matchingFamily(Cell left, Cell right)
           
static boolean matchingQualifier(Cell left, byte[] buf)
           
static boolean matchingQualifier(Cell left, Cell right)
           
static boolean matchingRow(Cell left, byte[] buf)
           
static boolean matchingRow(Cell left, Cell right)
           
static boolean matchingValue(Cell left, byte[] buf)
           
static boolean matchingValue(Cell left, Cell right)
           
static boolean overlappingKeys(byte[] start1, byte[] end1, byte[] start2, byte[] end2)
          Returns true if the first range start1...end1 overlaps with the second range start2...end2, assuming the byte arrays represent row keys
static Iterator<Tag> tagsIterator(byte[] tags, int offset, int length)
          Util method to iterate through the tags
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CellUtil

public CellUtil()
Method Detail

fillRowRange

public static ByteRange fillRowRange(Cell cell,
                                     ByteRange range)
ByteRange


fillFamilyRange

public static ByteRange fillFamilyRange(Cell cell,
                                        ByteRange range)

fillQualifierRange

public static ByteRange fillQualifierRange(Cell cell,
                                           ByteRange range)

fillTagRange

@InterfaceStability.Unstable
public static ByteRange fillTagRange(Cell cell,
                                                                 ByteRange range)

cloneRow

public static byte[] cloneRow(Cell cell)
get individual arrays for tests


cloneFamily

public static byte[] cloneFamily(Cell cell)

cloneQualifier

public static byte[] cloneQualifier(Cell cell)

cloneValue

public static byte[] cloneValue(Cell cell)

getTagArray

@InterfaceStability.Unstable
public static byte[] getTagArray(Cell cell)
Returns tag value in a new byte array. If server-side, use Tag.getBuffer() with appropriate Tag.getTagOffset() and Tag.getTagLength() instead to save on allocations.

Parameters:
cell -
Returns:
tag value in a new byte array.

copyRowTo

public static int copyRowTo(Cell cell,
                            byte[] destination,
                            int destinationOffset)
copyTo


copyFamilyTo

public static int copyFamilyTo(Cell cell,
                               byte[] destination,
                               int destinationOffset)

copyQualifierTo

public static int copyQualifierTo(Cell cell,
                                  byte[] destination,
                                  int destinationOffset)

copyValueTo

public static int copyValueTo(Cell cell,
                              byte[] destination,
                              int destinationOffset)

copyTagTo

@InterfaceStability.Unstable
public static int copyTagTo(Cell cell,
                                                        byte[] destination,
                                                        int destinationOffset)
Copies the tags info into the tag portion of the cell

Parameters:
cell -
destination -
destinationOffset -
Returns:
position after tags

getRowByte

public static byte getRowByte(Cell cell,
                              int index)
misc


getValueBufferShallowCopy

public static ByteBuffer getValueBufferShallowCopy(Cell cell)

getQualifierBufferShallowCopy

public static ByteBuffer getQualifierBufferShallowCopy(Cell cell)

createCell

public static Cell createCell(byte[] row,
                              byte[] family,
                              byte[] qualifier,
                              long timestamp,
                              byte type,
                              byte[] value)

createCell

public static Cell createCell(byte[] row,
                              byte[] family,
                              byte[] qualifier,
                              long timestamp,
                              byte type,
                              byte[] value,
                              long memstoreTS)

createCell

public static Cell createCell(byte[] row,
                              byte[] family,
                              byte[] qualifier,
                              long timestamp,
                              byte type,
                              byte[] value,
                              byte[] tags,
                              long memstoreTS)

createCell

public static Cell createCell(byte[] row,
                              byte[] family,
                              byte[] qualifier,
                              long timestamp,
                              KeyValue.Type type,
                              byte[] value,
                              byte[] tags)

createCellScanner

public static CellScanner createCellScanner(List<? extends CellScannable> cellScannerables)
Parameters:
cellScannerables -
Returns:
CellScanner interface over cellIterables

createCellScanner

public static CellScanner createCellScanner(Iterable<Cell> cellIterable)
Parameters:
cellIterable -
Returns:
CellScanner interface over cellIterable

createCellScanner

public static CellScanner createCellScanner(Iterator<Cell> cells)
Parameters:
cells -
Returns:
CellScanner interface over cellIterable or null if cells is null

createCellScanner

public static CellScanner createCellScanner(Cell[] cellArray)
Parameters:
cellArray -
Returns:
CellScanner interface over cellArray

createCellScanner

public static CellScanner createCellScanner(NavigableMap<byte[],List<Cell>> map)
Flatten the map of cells out under the CellScanner

Parameters:
map - Map of Cell Lists; for example, the map of families to Cells that is used inside Put, etc., keeping Cells organized by family.
Returns:
CellScanner interface over cellIterable

matchingRow

public static boolean matchingRow(Cell left,
                                  Cell right)
Parameters:
left -
right -
Returns:
True if the rows in left and right Cells match

matchingRow

public static boolean matchingRow(Cell left,
                                  byte[] buf)

matchingFamily

public static boolean matchingFamily(Cell left,
                                     Cell right)

matchingFamily

public static boolean matchingFamily(Cell left,
                                     byte[] buf)

matchingQualifier

public static boolean matchingQualifier(Cell left,
                                        Cell right)

matchingQualifier

public static boolean matchingQualifier(Cell left,
                                        byte[] buf)

matchingColumn

public static boolean matchingColumn(Cell left,
                                     byte[] fam,
                                     byte[] qual)

matchingColumn

public static boolean matchingColumn(Cell left,
                                     Cell right)

matchingValue

public static boolean matchingValue(Cell left,
                                    Cell right)

matchingValue

public static boolean matchingValue(Cell left,
                                    byte[] buf)

isDelete

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

isDeleteFamily

public static boolean isDeleteFamily(Cell cell)

estimatedSizeOf

public static int estimatedSizeOf(Cell cell)
Parameters:
cell -
Returns:
Estimate of the cell size in bytes.

tagsIterator

@InterfaceStability.Unstable
public static Iterator<Tag> tagsIterator(byte[] tags,
                                                                     int offset,
                                                                     int length)
Util method to iterate through the tags

Parameters:
tags -
offset -
length -
Returns:
iterator for the tags

isDeleteColumns

public static boolean isDeleteColumns(Cell cell)

isDeleteColumnVersion

public static boolean isDeleteColumnVersion(Cell cell)

overlappingKeys

public static boolean overlappingKeys(byte[] start1,
                                      byte[] end1,
                                      byte[] start2,
                                      byte[] end2)
Returns true if the first range start1...end1 overlaps with the second range start2...end2, assuming the byte arrays represent row keys



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