public static ByteBuffer copyKeyToNewByteBuffer(final ExtendedCell cell) {
    byte[] bytes = new byte[keyLength(cell)];
    appendKeyTo(cell, bytes, 0);
    ByteBuffer buffer = ByteBuffer.wrap(bytes);
    return buffer;
  }
The position will be set to the beginning of the new ByteBuffer
@return the Bytebuffer containing the key part of the cell
hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValueUtil.java