Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Help
12c (12.1.2)

E48720-01


oracle.help.common.util
Class LocaleUtils

java.lang.Object
  extended by oracle.help.common.util.LocaleUtils


public class LocaleUtils
extends java.lang.Object

Utility methods for common locale-sensitive operations


Method Summary
static java.io.InputStreamReader createInputStreamReader(java.io.InputStream aStream, java.lang.String encoding)
          Convenience method to create an InputStreamReader using the supplied InputStream and encoding.
static java.lang.String determineHelpSetEncoding(java.net.URL helpSetURL)
          Convenience method to determine a HelpSet's encoding by parsing for the xml encoding declaration.
static java.net.URL findLocalizedHelpSet(java.lang.String baseURLPath, java.lang.String pathExtension)
          Products that use Oracle Help often deliver multiple translated versions of the help content.
static java.net.URL findLocalizedHelpSet(java.lang.String baseURLPath, java.lang.String pathExtension, java.util.Locale desiredLocale)
          Products that use Oracle Help often deliver multiple translated versions of the help content.
static java.lang.String mapToJavaCharset(java.lang.String charset)
           

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Method Detail

findLocalizedHelpSet

public static final java.net.URL findLocalizedHelpSet(java.lang.String baseURLPath,
                                                      java.lang.String pathExtension)
Products that use Oracle Help often deliver multiple translated versions of the help content. A common way of organizing localized help content is to use directories named with the iso language and country codes. Assuming such a directory naming scheme is used, this method will aid in finding a localized helpset that matches the LocaleUtils locale.

This method uses a fallback mechanism similar to Java resource bundles. For example, if you pass in XXX as the baseURLPath, and YYY as the pathExtension it will attempt to locate the helpset by checking whether or not files exist at these locations (in this order):

XXX_lang_COUNTRY_VARIANT/YYY
XXX_lang_COUNTRY/YYY
XXX_lang/YYY
XXX/YYY

Where lang, COUNTRY, and VARIANT are taken from the LocaleUtils locale.

Examples of how this method could be used:


findLocalizedHelpSet

public static final java.net.URL findLocalizedHelpSet(java.lang.String baseURLPath,
                                                      java.lang.String pathExtension,
                                                      java.util.Locale desiredLocale)
Products that use Oracle Help often deliver multiple translated versions of the help content. A common way of organizing localized help content is to use directories named with the iso language and country codes. Assuming such a directory naming scheme is used, this method will aid in finding a localized helpset that matches the desiredLocale parameter.

This method uses a fallback mechanism similar to Java resource bundles. For example, if you pass in XXX as the baseURLPath, and YYY as the pathExtension it will attempt to locate the helpset by checking whether or not files exist at these locations (in this order):

XXX_lang_COUNTRY_VARIANT/YYY
XXX_lang_COUNTRY/YYY
XXX_lang/YYY
XXX/YYY

Where lang, COUNTRY, and VARIANT are taken from the desiredLocale passed into this method.

Examples of how this method could be used:


determineHelpSetEncoding

public static final java.lang.String determineHelpSetEncoding(java.net.URL helpSetURL)
Convenience method to determine a HelpSet's encoding by parsing for the xml encoding declaration. If the declaration is found, OHJ attempts to map the IANA name to a Java supported name using an encoding table. If no mapping is found, the specified IANA name is returned. If no encoding declaration can be found (or in an error condition), this method returns null. The return value of this method can be passed into the createInputStreamReader() methods in this class to create a reader for the HelpSet file (and other control files in the HelpSet).

createInputStreamReader

public static final java.io.InputStreamReader createInputStreamReader(java.io.InputStream aStream,
                                                                      java.lang.String encoding)
Convenience method to create an InputStreamReader using the supplied InputStream and encoding. If the encoding is unsupported, the method will return an InputStreamReader created with the default encoding of the default Locale.

mapToJavaCharset

public static java.lang.String mapToJavaCharset(java.lang.String charset)

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Help
12c (12.1.2)

E48720-01


Copyright © 1998, 2013, Oracle. All Rights Reserved.