public byte[] getKey() {
    int keylength = getKeyLength();
    byte[] key = new byte[keylength];
    System.arraycopy(getBuffer(), getKeyOffset(), key, 0, keylength);
    return key;
  }
Do not use unless you have to. Used internally for compacting and testing. Use
{@link #getRowArray()}, {@link #getFamilyArray()}, {@link #getQualifierArray()}, and
{@link #getValueArray()} if accessing a KeyValue client-side.
@return Copy of the key portion only.
hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java