示例#1
0
 /**
  * @param left
  * @param right
  * @return True if the rows in <code>left</code> and <code>right</code> Cells match
  */
 public static boolean matchingRow(final Cell left, final Cell right) {
   return Bytes.equals(
       left.getRowArray(),
       left.getRowOffset(),
       left.getRowLength(),
       right.getRowArray(),
       right.getRowOffset(),
       right.getRowLength());
 }
示例#2
0
 /** ****************** copyTo ********************************* */
 public static int copyRowTo(Cell cell, byte[] destination, int destinationOffset) {
   System.arraycopy(
       cell.getRowArray(),
       cell.getRowOffset(),
       destination,
       destinationOffset,
       cell.getRowLength());
   return destinationOffset + cell.getRowLength();
 }
示例#3
0
 /**
  * @param cell
  * @return Estimate of the <code>cell</code> size in bytes.
  */
 public static int estimatedSizeOf(final Cell cell) {
   // If a KeyValue, we can give a good estimate of size.
   if (cell instanceof KeyValue) {
     return ((KeyValue) cell).getLength() + Bytes.SIZEOF_INT;
   }
   // TODO: Should we add to Cell a sizeOf?  Would it help? Does it make sense if Cell is
   // prefix encoded or compressed?
   return cell.getRowLength()
       + cell.getFamilyLength()
       + cell.getQualifierLength()
       + cell.getValueLength()
       +
       // Use the KeyValue's infrastructure size presuming that another implementation would have
       // same basic cost.
       KeyValue.KEY_INFRASTRUCTURE_SIZE
       +
       // Serialization is probably preceded by a length (it is in the KeyValueCodec at least).
       Bytes.SIZEOF_INT;
 }
示例#4
0
 /** *************** get individual arrays for tests *********** */
 public static byte[] cloneRow(Cell cell) {
   byte[] output = new byte[cell.getRowLength()];
   copyRowTo(cell, output, 0);
   return output;
 }
示例#5
0
 /** ***************** ByteRange ****************************** */
 public static ByteRange fillRowRange(Cell cell, ByteRange range) {
   return range.set(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
 }
示例#6
0
 public static boolean matchingRow(
     final Cell left, final byte[] buf, final int offset, final int length) {
   return Bytes.equals(
       left.getRowArray(), left.getRowOffset(), left.getRowLength(), buf, offset, length);
 }
 public static void assertKey(final byte[] expected, final Cell c) {
   assertKey(expected, c.getRowArray(), c.getRowOffset(), c.getRowLength());
 }