public static byte[] copyToNewByteArray(final ExtendedCell cell) {
    // Cell#getSerializedSize returns the serialized size of the Source cell, which may
    // not serialize all fields. We are constructing a KeyValue backing array here,
    // which does include all fields, and must allocate accordingly.
    // TODO we could probably use Cell#getSerializedSize safely, the errors were
    // caused by cells corrupted by use-after-free bugs
    int v1Length = length(cell.getRowLength(), cell.getFamilyLength(), cell.getQualifierLength(),
      cell.getValueLength(), cell.getTagsLength(), true);
    byte[] backingBytes = new byte[v1Length];
    appendToByteArray(cell, backingBytes, 0, true);
    return backingBytes;
  }
Copies the key to a new KeyValue
@return the KeyValue that consists only the key part of the incoming cell
hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValueUtil.java