Class ManifestHelper


  • public class ManifestHelper
    extends java.lang.Object
    An helper to extract manifest headers taking into account the localization.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ManifestHelper​(Jar jar, java.util.jar.Manifest manifest, java.util.Locale locale)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ManifestHelper createIfPresent​(Jar jar, java.util.Locale locale)
      Create a ManifestHelper if the specified jar contains a manifest, otherwise return null.
      Parameters getHeader​(java.lang.String headerName, boolean allowDuplicateAttributes)
      Gets the header value for the locale of this helper instance.
      java.lang.String getHeaderAsString​(java.lang.String headerName)
      Gets the header value for the locale of this helper instance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_LOCALIZATION_BASE

        private static final java.lang.String DEFAULT_LOCALIZATION_BASE
        See Also:
        Constant Field Values
      • _manifest

        private final java.util.jar.Manifest _manifest
    • Constructor Detail

      • ManifestHelper

        private ManifestHelper​(Jar jar,
                               java.util.jar.Manifest manifest,
                               java.util.Locale locale)
    • Method Detail

      • createIfPresent

        public static ManifestHelper createIfPresent​(Jar jar,
                                                     java.util.Locale locale)
        Create a ManifestHelper if the specified jar contains a manifest, otherwise return null.
        Parameters:
        jar - the jar, must not be null
        locale - the locale, must not be null
        Returns:
        the helper or null if the jar does not contain a manifest
      • getHeader

        public Parameters getHeader​(java.lang.String headerName,
                                    boolean allowDuplicateAttributes)
        Gets the header value for the locale of this helper instance.

        Values will be search from the most specific to the less specific locale including unlocalized (empty locale) value.

        Parameters:
        headerName - the header to extract, must not be null
        allowDuplicateAttributes - true if the header allow duplicate attributes
        Returns:
        the header value, never null
      • getHeaderAsString

        public java.lang.String getHeaderAsString​(java.lang.String headerName)
        Gets the header value for the locale of this helper instance.

        Values will be search from the most specific to the less specific locale including unlocalized (empty locale) value.

        Parameters:
        headerName - the header to extract, must not be null
        Returns:
        the header value, never null