static DeserializedUserMetadata deserializeAndGetUserMetadataWithVersion(InputStream stream)
      throws IOException, MessageFormatException {
    CrcInputStream crcStream = new CrcInputStream(stream);
    DataInputStream inputStream = new DataInputStream(crcStream);
    short version = inputStream.readShort();
    switch (version) {
      case UserMetadata_Version_V1:
        return new DeserializedUserMetadata(UserMetadata_Version_V1,
            UserMetadata_Format_V1.deserializeUserMetadataRecord(crcStream));
      default:
        throw new MessageFormatException("metadata version not supported",
            MessageFormatErrorCodes.UnknownFormatVersion);
    }
  }
Format a header for the given version using the given content.
@param headerVersion the version of the header.
@param input the input content that is to be formatted in the appropriate header version.
@return a formatted header for the given version.
@throws MessageFormatException if the given header version is invalid.
ambry-messageformat/src/main/java/com/github/ambry/messageformat/MessageFormatRecord.java