public static void writeRowKeyExcludingCommon(Cell cell, short rLen, int commonPrefix,
    DataOutputStream out) throws IOException {
    if (commonPrefix == 0) {
      out.writeShort(rLen);
    } else if (commonPrefix == 1) {
      out.writeByte((byte) rLen);
      commonPrefix--;
    } else {
      commonPrefix -= KeyValue.ROW_LENGTH_SIZE;
    }
    if (rLen > commonPrefix) {
      writeRowSkippingBytes(out, cell, rLen, commonPrefix);
    }
  }
Write rowkey excluding the common part.
hbase-common/src/main/java/org/apache/hadoop/hbase/PrivateCellUtil.java