public static int getHeaderSizeForVersion(short headerVersion) throws MessageFormatException {
    switch (headerVersion) {
      case Message_Header_Version_V1:
        return MessageHeader_Format_V1.getHeaderSize();
      case Message_Header_Version_V2:
        return MessageHeader_Format_V2.getHeaderSize();
      case Message_Header_Version_V3:
        return MessageHeader_Format_V3.getHeaderSize();
      default:
        throw new MessageFormatException("Unknown header version: " + headerVersion,
            MessageFormatErrorCodes.UnknownFormatVersion);
    }
  }
Get the size of the header for the given header version.
@param headerVersion the version of the header for which the size is to be determined.
@return the size of the header for the given header version.
@throws MessageFormatException if the given header version is invalid.
ambry-messageformat/src/main/java/com/github/ambry/messageformat/MessageFormatRecord.java