Class HyphenationTreeCache

java.lang.Object
com.itextpdf.layout.hyphenation.HyphenationTreeCache

public class HyphenationTreeCache extends Object
This is a cache for HyphenationTree instances.
  • Constructor Details

    • HyphenationTreeCache

      public HyphenationTreeCache()
  • Method Details

    • getHyphenationTree

      public HyphenationTree getHyphenationTree (String lang, String country)
      Looks in the cache if a hyphenation tree is available and returns it if it is found.
      Parameters:
      lang - the language
      country - the country (may be null or "none")
      Returns:
      the HyhenationTree instance or null if it's not in the cache
    • constructLlccKey

      public static String constructLlccKey (String lang, String country)
      Constructs the key for the hyphenation pattern file.
      Parameters:
      lang - the language
      country - the country (may be null or "none")
      Returns:
      the resulting key
    • constructUserKey

      public static String constructUserKey (String lang, String country, Map<String,String> hyphPatNames)
      If the user configured a hyphenation pattern file name for this (lang,country) value, return it. If not, return null.
      Parameters:
      lang - the language
      country - the country (may be null or "none")
      hyphPatNames - the map of user-configured hyphenation pattern file names
      Returns:
      the hyphenation pattern file name or null
    • cache

      public void cache (String key, HyphenationTree hTree)
      Cache a hyphenation tree under its key.
      Parameters:
      key - the key (ex. "de_CH" or "en")
      hTree - the hyphenation tree
    • noteMissing

      public void noteMissing (String key)
      Notes a key to a hyphenation tree as missing. This is to avoid searching a second time for a hyphenation pattern file which is not available.
      Parameters:
      key - the key (ex. "de_CH" or "en")
    • isMissing

      public boolean isMissing (String key)
      Indicates whether a hyphenation file has been requested before but it wasn't available. This is to avoid searching a second time for a hyphenation pattern file which is not available.
      Parameters:
      key - the key (ex. "de_CH" or "en")
      Returns:
      true if the hyphenation tree is unavailable