public static int copyValueTo(Cell cell, ByteBuffer destination, int destinationOffset) {
    int vlen = cell.getValueLength();
    if (cell instanceof ByteBufferExtendedCell) {
      ByteBufferUtils.copyFromBufferToBuffer(((ByteBufferExtendedCell) cell).getValueByteBuffer(),
        destination, ((ByteBufferExtendedCell) cell).getValuePosition(), destinationOffset, vlen);
    } else {
      ByteBufferUtils.copyFromArrayToBuffer(destination, destinationOffset, cell.getValueArray(),
        cell.getValueOffset(), vlen);
    }
    return destinationOffset + vlen;
  }
Copies the value to the given bytebuffer
@param cell              the cell whose value has to be copied
@param destination       the destination bytebuffer to which the value has to be copied
@param destinationOffset the offset in the destination bytebuffer
@return the offset of the bytebuffer after the copy has happened
hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java