public static int copyRowTo(Cell cell, ByteBuffer destination, int destinationOffset) {
    short rowLen = cell.getRowLength();
    if (cell instanceof ByteBufferExtendedCell) {
      ByteBufferUtils.copyFromBufferToBuffer(((ByteBufferExtendedCell) cell).getRowByteBuffer(),
        destination, ((ByteBufferExtendedCell) cell).getRowPosition(), destinationOffset, rowLen);
    } else {
      ByteBufferUtils.copyFromArrayToBuffer(destination, destinationOffset, cell.getRowArray(),
        cell.getRowOffset(), rowLen);
    }
    return destinationOffset + rowLen;
  }
Copies the row to the given bytebuffer
@param cell              cell the cell whose row has to be copied
@param destination       the destination bytebuffer to which the row has to be copied
@param destinationOffset the offset in the destination byte[]
@return the offset of the bytebuffer after the copy has happened
hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java