private static int getLength(byte[] bytes, int offset) {
    int klength = ROW_OFFSET + Bytes.toInt(bytes, offset);
    int vlength = Bytes.toInt(bytes, offset + Bytes.SIZEOF_INT);
    return klength + vlength;
  }
Determines the total length of the KeyValue stored in the specified byte array and offset.
Includes all headers.
@param bytes  byte array
@param offset offset to start of the KeyValue
@return length of entire KeyValue, in bytes
hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java