public KeyValue createKeyOnly(boolean lenAsVal) {
    // KV format: <keylen:4><valuelen:4><key:keylen><value:valuelen>
    // Rebuild as: <keylen:4><0:4><key:keylen>
    int dataLen = lenAsVal ? Bytes.SIZEOF_INT : 0;
    byte[] newBuffer = new byte[getKeyLength() + ROW_OFFSET + dataLen];
    System.arraycopy(this.bytes, this.offset, newBuffer, 0,
      Math.min(newBuffer.length, this.length));
    Bytes.putInt(newBuffer, Bytes.SIZEOF_INT, dataLen);
    if (lenAsVal) {
      Bytes.putInt(newBuffer, newBuffer.length - dataLen, this.getValueLength());
    }
    return new KeyValue(newBuffer);
  }
Creates a new KeyValue that only contains the key portion (the value is set to be null). TODO
only used by KeyOnlyFilter -- move there.
@param lenAsVal replace value with the actual value length (false=empty)
hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java