Class ICUData

java.lang.Object
com.ibm.icu.impl.ICUData

public final class ICUData extends Object
Provides access to ICU data files as InputStreams. Implements security checking.
  • Field Details

    • ICU_DATA_PATH

      static final String ICU_DATA_PATH
      The data path to be used with getBundleInstance API
      See Also:
    • PACKAGE_NAME

      static final String PACKAGE_NAME
      The ICU data package name. This is normally the name of the .dat package, and the prefix (plus '/') of the package entry names.
      See Also:
    • ICU_BUNDLE

      public static final String ICU_BUNDLE
      The data path to be used with Class.getResourceAsStream().
      See Also:
    • ICU_BASE_NAME

      public static final String ICU_BASE_NAME
      The base name of ICU data to be used with ClassLoader.getResourceAsStream(), ICUResourceBundle.getBundleInstance() etc.
      See Also:
    • ICU_COLLATION_BASE_NAME

      public static final String ICU_COLLATION_BASE_NAME
      The base name of collation data to be used with getBundleInstance API
      See Also:
    • ICU_BRKITR_NAME

      public static final String ICU_BRKITR_NAME
      The base name of rbbi data to be used with getData API
      See Also:
    • ICU_BRKITR_BASE_NAME

      public static final String ICU_BRKITR_BASE_NAME
      The base name of rbbi data to be used with getBundleInstance API
      See Also:
    • ICU_RBNF_BASE_NAME

      public static final String ICU_RBNF_BASE_NAME
      The base name of rbnf data to be used with getBundleInstance API
      See Also:
    • ICU_TRANSLIT_BASE_NAME

      public static final String ICU_TRANSLIT_BASE_NAME
      The base name of transliterator data to be used with getBundleInstance API
      See Also:
    • ICU_LANG_BASE_NAME

      public static final String ICU_LANG_BASE_NAME
      See Also:
    • ICU_CURR_BASE_NAME

      public static final String ICU_CURR_BASE_NAME
      See Also:
    • ICU_REGION_BASE_NAME

      public static final String ICU_REGION_BASE_NAME
      See Also:
    • ICU_ZONE_BASE_NAME

      public static final String ICU_ZONE_BASE_NAME
      See Also:
    • ICU_UNIT_BASE_NAME

      public static final String ICU_UNIT_BASE_NAME
      See Also:
    • logBinaryDataFromInputStream

      private static final boolean logBinaryDataFromInputStream
      For testing (otherwise false): When reading an InputStream from a Class or ClassLoader (that is, not from a file), log when the stream contains ICU binary data. This cannot be ICUConfig'ured because ICUConfig calls ICUData.getStream() to read the properties file, so we would get a circular dependency in the class initialization.
      See Also:
    • logger

      private static final Logger logger
  • Constructor Details

    • ICUData

      public ICUData()
  • Method Details

    • exists

      public static boolean exists(String resourceName)
    • getStream

      private static InputStream getStream(Class<?> root, String resourceName, boolean required)
    • getStream

      static InputStream getStream(ClassLoader loader, String resourceName, boolean required)
      Should be called only from ICUBinary.getData() or from convenience overloads here.
    • checkStreamForBinaryData

      private static void checkStreamForBinaryData(InputStream is, String resourceName)
    • getStream

      public static InputStream getStream(ClassLoader loader, String resourceName)
    • getRequiredStream

      public static InputStream getRequiredStream(ClassLoader loader, String resourceName)
    • getStream

      public static InputStream getStream(String resourceName)
      Convenience override that calls getStream(ICUData.class, resourceName, false); Returns null if the resource could not be found.
    • getRequiredStream

      public static InputStream getRequiredStream(String resourceName)
      Convenience method that calls getStream(ICUData.class, resourceName, true).
      Throws:
      MissingResourceException - if the resource could not be found
    • getStream

      public static InputStream getStream(Class<?> root, String resourceName)
      Convenience override that calls getStream(root, resourceName, false); Returns null if the resource could not be found.
    • getRequiredStream

      public static InputStream getRequiredStream(Class<?> root, String resourceName)
      Convenience method that calls getStream(root, resourceName, true).
      Throws:
      MissingResourceException - if the resource could not be found