@InterfaceAudience.Public public final class CellUtil extends Object
Cell
instances. Some methods below are for internal
use only and are marked InterfaceAudience.Private at the method level. Note that all such methods
have been marked deprecated in HBase-2.0 which will be subsequently removed in HBase-3.0Modifier and Type | Method and Description |
---|---|
static byte[] |
cloneFamily(Cell cell) |
static void |
cloneIfNecessary(ArrayList<Cell> cells) |
static Cell |
cloneIfNecessary(Cell cell) |
static byte[] |
cloneQualifier(Cell cell) |
static byte[] |
cloneRow(Cell cell)
get individual arrays for tests
|
static byte[] |
cloneValue(Cell cell) |
static int |
compareColumns(Cell left,
byte[] right,
int rfoffset,
int rflength,
int rqoffset,
int rqlength)
Compares the cell's column (family and qualifier) with the given byte[]
|
static int |
compareFamilies(Cell left,
byte[] right,
int roffset,
int rlength)
Compares the cell's family with the given byte[]
|
static int |
compareQualifiers(Cell left,
byte[] right,
int rOffset,
int rLength)
Compares the cell's qualifier with the given byte[]
|
static int |
copyFamilyTo(Cell cell,
byte[] destination,
int destinationOffset)
Copies the family to the given byte[]
|
static int |
copyFamilyTo(Cell cell,
ByteBuffer destination,
int destinationOffset)
Copies the family to the given bytebuffer
|
static int |
copyQualifierTo(Cell cell,
byte[] destination,
int destinationOffset)
Copies the qualifier to the given byte[]
|
static int |
copyQualifierTo(Cell cell,
ByteBuffer destination,
int destinationOffset)
Copies the qualifier to the given bytebuffer
|
static byte[] |
copyRow(Cell cell)
Copies the row to a new byte[]
|
static int |
copyRowTo(Cell cell,
byte[] destination,
int destinationOffset)
Copies the row to the given byte[]
|
static int |
copyRowTo(Cell cell,
ByteBuffer destination,
int destinationOffset)
Copies the row to the given bytebuffer
|
static int |
copyValueTo(Cell cell,
byte[] destination,
int destinationOffset)
Copies the value to the given byte[]
|
static int |
copyValueTo(Cell cell,
ByteBuffer destination,
int destinationOffset)
Copies the value to the given bytebuffer
|
static CellScanner |
createCellScanner(Cell[] cellArray)
Returns CellScanner interface over
cellArray |
static CellScanner |
createCellScanner(Iterable<Cell> cellIterable)
Returns CellScanner interface over
cellIterable |
static CellScanner |
createCellScanner(Iterator<Cell> cells)
Returns CellScanner interface over
cellIterable or null if cells is
null |
static CellScanner |
createCellScanner(List<? extends CellScannable> cellScannerables)
Returns CellScanner interface over
cellIterables |
static CellScanner |
createCellScanner(NavigableMap<byte[],List<Cell>> map)
Flatten the map of cells out under the CellScanner
|
static boolean |
equals(Cell a,
Cell b)
equals
|
static String |
getCellKeyAsString(Cell cell)
Returns The Key portion of the passed
cell as a String. |
static String |
getCellKeyAsString(Cell cell,
Function<Cell,String> rowConverter)
Return the Key portion of the passed
cell as a String. |
static boolean |
isDelete(Cell cell)
Return true if a delete type, a
KeyValue.Type.Delete or a {KeyValue.Type#DeleteFamily}
or a KeyValue.Type.DeleteColumn KeyValue type. |
static boolean |
isPut(Cell cell)
Returns True if this cell is a Put.
|
static byte[] |
makeColumn(byte[] family,
byte[] qualifier)
Makes a column in family:qualifier form from separate byte arrays.
|
static boolean |
matchingColumn(Cell left,
byte[] fam,
byte[] qual) |
static boolean |
matchingColumn(Cell left,
Cell right) |
static boolean |
matchingColumnFamilyAndQualifierPrefix(Cell left,
byte[] fam,
byte[] qual)
Returns True if matching column family and the qualifier starts with
qual |
static boolean |
matchingFamily(Cell left,
byte[] buf) |
static boolean |
matchingFamily(Cell left,
byte lfamlength,
Cell right,
byte rfamlength) |
static boolean |
matchingFamily(Cell left,
Cell right) |
static boolean |
matchingQualifier(Cell left,
byte[] buf)
Finds if the qualifier part of the cell and the KV serialized byte[] are equal.
|
static boolean |
matchingQualifier(Cell left,
Cell right) |
static boolean |
matchingRow(Cell left,
byte[] buf,
int offset,
int length) |
static boolean |
matchingRowColumn(Cell left,
Cell right)
Compares the row and column of two keyvalues for equality
|
static boolean |
matchingRowColumnBytes(Cell left,
Cell right)
Compares the row and column of two keyvalues for equality
|
static boolean |
matchingRows(Cell left,
byte[] buf) |
static boolean |
matchingRows(Cell left,
Cell right)
Compares the row of two keyvalues for equality
|
static boolean |
matchingRows(Cell left,
short lrowlength,
Cell right,
short rrowlength)
Compares the row of two keyvalues for equality
|
static boolean |
matchingTags(Cell left,
Cell right) |
static boolean |
matchingTimestamp(Cell a,
Cell b) |
static boolean |
matchingValue(Cell left,
byte[] buf) |
static boolean |
matchingValue(Cell left,
Cell right) |
static boolean |
matchingValue(Cell left,
Cell right,
int lvlength,
int rvlength) |
static byte[][] |
parseColumn(byte[] c)
Splits a column in
family:qualifier form into separate byte arrays. |
static String |
toString(Cell cell,
boolean verbose)
Returns a string representation of the cell
|
public static byte[] cloneFamily(Cell cell)
public static byte[] cloneQualifier(Cell cell)
public static byte[] cloneValue(Cell cell)
public static byte[] makeColumn(byte[] family, byte[] qualifier)
Not recommended for usage as this is old-style API.
public static byte[][] parseColumn(byte[] c)
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.
c
- The column.public static int copyRowTo(Cell cell, byte[] destination, int destinationOffset)
cell
- the cell whose row has to be copieddestination
- the destination byte[] to which the row has to be copieddestinationOffset
- the offset in the destination byte[]public static int copyRowTo(Cell cell, ByteBuffer destination, int destinationOffset)
cell
- cell the cell whose row has to be copieddestination
- the destination bytebuffer to which the row has to be copieddestinationOffset
- the offset in the destination byte[]public static byte[] copyRow(Cell cell)
cell
- the cell from which row has to copiedpublic static int copyFamilyTo(Cell cell, byte[] destination, int destinationOffset)
cell
- the cell whose family has to be copieddestination
- the destination byte[] to which the family has to be copieddestinationOffset
- the offset in the destination byte[]public static int copyFamilyTo(Cell cell, ByteBuffer destination, int destinationOffset)
cell
- the cell whose family has to be copieddestination
- the destination bytebuffer to which the family has to be copieddestinationOffset
- the offset in the destination bytebufferpublic static int copyQualifierTo(Cell cell, byte[] destination, int destinationOffset)
cell
- the cell whose qualifier has to be copieddestination
- the destination byte[] to which the qualifier has to be copieddestinationOffset
- the offset in the destination byte[]public static int copyQualifierTo(Cell cell, ByteBuffer destination, int destinationOffset)
cell
- the cell whose qualifier has to be copieddestination
- the destination bytebuffer to which the qualifier has to be copieddestinationOffset
- the offset in the destination bytebufferpublic static int copyValueTo(Cell cell, byte[] destination, int destinationOffset)
cell
- the cell whose value has to be copieddestination
- the destination byte[] to which the value has to be copieddestinationOffset
- the offset in the destination byte[]public static int copyValueTo(Cell cell, ByteBuffer destination, int destinationOffset)
cell
- the cell whose value has to be copieddestination
- the destination bytebuffer to which the value has to be copieddestinationOffset
- the offset in the destination bytebufferpublic static CellScanner createCellScanner(List<? extends CellScannable> cellScannerables)
cellIterables
public static CellScanner createCellScanner(Iterable<Cell> cellIterable)
cellIterable
public static CellScanner createCellScanner(Iterator<Cell> cells)
cellIterable
or null if cells
is
nullpublic static CellScanner createCellScanner(Cell[] cellArray)
cellArray
public static CellScanner createCellScanner(NavigableMap<byte[],List<Cell>> map)
map
- Map of Cell Lists; for example, the map of families to Cells that is used inside
Put, etc., keeping Cells organized by family.cellIterable
public static boolean matchingRows(Cell left, byte[] buf)
public static boolean matchingRow(Cell left, byte[] buf, int offset, int length)
public static boolean matchingFamily(Cell left, Cell right)
public static boolean matchingFamily(Cell left, byte lfamlength, Cell right, byte rfamlength)
public static boolean matchingFamily(Cell left, byte[] buf)
public static boolean matchingQualifier(Cell left, Cell right)
public static boolean matchingQualifier(Cell left, byte[] buf)
public static boolean matchingColumn(Cell left, byte[] fam, byte[] qual)
public static boolean matchingColumnFamilyAndQualifierPrefix(Cell left, byte[] fam, byte[] qual)
qual
public static boolean matchingColumn(Cell left, Cell right)
public static boolean matchingValue(Cell left, Cell right)
public static boolean matchingValue(Cell left, Cell right, int lvlength, int rvlength)
public static boolean matchingValue(Cell left, byte[] buf)
public static boolean matchingTags(Cell left, Cell right)
public static boolean isDelete(Cell cell)
KeyValue.Type.Delete
or a {KeyValue.Type#DeleteFamily}
or a KeyValue.Type.DeleteColumn
KeyValue type.public static String getCellKeyAsString(Cell cell)
cell
as a String.public static String getCellKeyAsString(Cell cell, Function<Cell,String> rowConverter)
cell
as a String.cell
- the cell to convertrowConverter
- used to convert the row of the cell to a stringcell
as a String.public static String toString(Cell cell, boolean verbose)
public static boolean matchingTimestamp(Cell a, Cell b)
public static boolean matchingRows(Cell left, Cell right)
public static boolean matchingRows(Cell left, short lrowlength, Cell right, short rrowlength)
public static boolean matchingRowColumn(Cell left, Cell right)
public static boolean matchingRowColumnBytes(Cell left, Cell right)
public static final int compareQualifiers(Cell left, byte[] right, int rOffset, int rLength)
left
- the cell for which the qualifier has to be comparedright
- the byte[] having the qualifierrOffset
- the offset of the qualifierrLength
- the length of the qualifierpublic static final int compareFamilies(Cell left, byte[] right, int roffset, int rlength)
left
- the cell for which the family has to be comparedright
- the byte[] having the familyroffset
- the offset of the familyrlength
- the length of the familypublic static final int compareColumns(Cell left, byte[] right, int rfoffset, int rflength, int rqoffset, int rqlength)
left
- the cell for which the column has to be comparedright
- the byte[] having the columnrfoffset
- the offset of the familyrflength
- the length of the familyrqoffset
- the offset of the qualifierrqlength
- the length of the qualifierpublic static void cloneIfNecessary(ArrayList<Cell> cells)
public static Cell cloneIfNecessary(Cell cell)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.