|
Oracle® Globalization Development Kit Java API Reference 10g Release 2 (10.2) Part No. B14224-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.i18n.util.LocaleMapper
The LocaleMapper
class maps between Oracle locale elements and equivalent locale elements in other vendors and standards. This class contains the same mapping data as the NLSRTL C library and Java oracle.gss.util
package.
The locale mappings are available for Oracle and Java locales. The character set encoding mappings are available for Oracle, Java, and IANA.
Oracle character set encoding is the character set part of the NLS_LANG
parameter. Java character set encoding is the available character set in Java. IANA character set encoding is the character set that is defined by IANA and widely used by various applications such as web browser or e-mail application.
Field Summary | |
static int |
EMAIL_UNIX Constant value to represent Unix for e-mail. |
static int |
EMAIL_WINDOWS Constant value to represent Windows for e-mail. |
static int |
IANA Constant value to represent IANA. |
static int |
JAVA Constant value to represent Java. |
static int |
ORACLE Constant value to represent Oracle. |
static int |
UNIX Constant value to represent Unix in general. |
static int |
WINDOWS Constant value to represent Windows in general. |
Method Summary | |
static String[] |
getAvailableIANACharacterSets() Returns an array of all IANA character set names that have corresponding Oracle character sets. |
static String[] |
getAvailableOraCharacterSets() Returns an array of all Oracle character set names that have corresponding IANA character sets. |
static String |
getIANACharacterSet(int from, String charset) Returns the IANA character set that is equivalent to the passed in Oracle or Java character set. |
static String[] |
getIANACharSetFromLocale(int context, Locale locale) Returns the commonly used IANA character set based on the given context and locale. |
static String[] |
getIANACharSetFromOraLang(int context, String oraLanguage) Returns the commonly used IANA character set based on the given context and Oracle language. |
static String |
getJavaCharacterSet(int from, String charset) Returns the Java character set that is equivalent to the passed in Oracle or IANA character set. |
static String |
getJavaLangFromOraLang(String lang) Returns the ISO 639 two-letter code for the given Oracle language name. |
static Locale |
getJavaLocale(String nlsLocale) Returns a Java Locale instance that is equivalent to the Oracle locale specified by the passed in Oracle language and territory. |
static Locale |
getJavaLocale(String oraLanguage, String oraTerritory) Returns a Java Locale instance that is equivalent to the Oracle locale specified by the passed in Oracle language and territory. |
static String |
getJavaTerrFromOraTerr(String terr) Returns the ISO 3166 two-letter code for the given Oracle territory name. |
static String |
getOraCharacterSet(int from, String charset) Returns the Oracle character set that is equivalent to the passed in Java character set. |
static String[] |
getOraCharSetFromOraLang(int context, String oraLanguage) Returns the commonly used Oracle character set based on the given context and Oracle language. |
static String |
getOraLangFromJavaLang(String lang) Returns the Oracle language name for the given ISO 639 two-letter code. |
static String |
getOraLanguage(Locale locale) Returns the Oracle language name based on the given Java Locale instance. |
static String |
getOraLanguageFromShortName(String oraShortName) Returns the Oracle language name from the Oracle short language name. |
static String |
getOraLinguisticSortFromLocale(Locale locale) Returns the default Oracle linguistic sort name for the locale. |
static String |
getOraLocale(Locale locale) Returns the Oracle language and Oracle territory name for the given Java Locale instance in the <Oracle Language>_<Oracle Territory> form. |
static String |
getOraShortNameFromLanguage(String oraLanguage) Returns the Oracle short language name from the Oracle language name. |
static String |
getOraTerrFromJavaTerr(String terr) Returns the Oracle territory name for the given ISO 3166 two-letter code. |
static String |
getOraTerritory(Locale locale) Returns the Oracle territory name for the given Java Locale instance. |
static boolean |
isSupersetOf(int csid, int key) Return true if the charset ID specified by key is a superset of the charset specified by csid |
static void |
setJavaCharacterSet(int from, String charset, String encoding) Associates a default encoding with a character set. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ORACLE
public static final int IANA
public static final int JAVA
public static final int EMAIL_WINDOWS
public static final int EMAIL_UNIX
public static final int WINDOWS
public static final int UNIX
Method Detail |
public static String[] getAvailableIANACharacterSets()
String
containing the list of IANA namespublic static String[] getAvailableOraCharacterSets()
String
containing the list of Oracle namespublic static boolean isSupersetOf(int csid, int key)
public static String getIANACharacterSet(int from, String charset)
from
- can be ORACLE
or JAVA
charset
- character set name with which we want to find an equivalent IANA character setnull
if not foundpublic static void setJavaCharacterSet(int from, String charset, String encoding) throws UnsupportedEncodingException
Associates a default encoding with a character set. This method can be used to choose a default encoding associated with a character set that can be represented as various flavors of encodings. Once the default encoding is associated, any calls to the getJavaCharacterSet(int, String)
method will retrieve the associated encoding. For instance:
LocaleMapper.setJavaCharacterSet(LocaleMapper.IANA,
"ISO-2022-JP", "X-ORACLE-ISO2022-JP-OUTLOOK");
...
// cs will be assigned the value "X-ORACLE-ISO2022-JP-OUTLOOK"
String cs = LocaleMapper.getJavaCharacterSet(IANA, "ISO-2022-JP");
from
- - must be IANA (for now)charset
- - IANA charset nameencoding
- - the encoding to which we want to setUnsupportedEncodingException
public static String getJavaCharacterSet(int from, String charset)
from
- can be ORACLE
or IANA
charset
- character set name with which we want to find an equivalent Java character setnull
if not foundpublic static String getOraCharacterSet(int from, String charset)
from
- can be IANA
or JAVA
charset
- character set name with which we want to find an equivalent Oracle character setnull
if not foundpublic static Locale getJavaLocale(String nlsLocale)
Locale
instance that is equivalent to the Oracle locale specified by the passed in Oracle language and territory.nlsLocale
- NLS_LANG
string where Oracle language and territory are connected with the underscore '_'Locale
instance; defaults to en_US
public static Locale getJavaLocale(String oraLanguage, String oraTerritory)
Locale
instance that is equivalent to the Oracle locale specified by the passed in Oracle language and territory.oraLanguage
- Oracle languageoraTerritory
- Oracle territoryLocale
instance; defaults to en_US
public static String getOraLanguageFromShortName(String oraShortName)
oraShortName
- Oracle short language namepublic static String getOraShortNameFromLanguage(String oraLanguage)
oraLanguage
- Oracle language namepublic static String getOraLanguage(Locale locale)
Locale
instance.locale
- Java Locale
instancenull
if no corresponding Oracle language is foundpublic static String getOraTerritory(Locale locale)
Locale
instance.locale
- Java Locale
instanceLocale
instancepublic static String getOraLocale(Locale locale)
Locale
instance in the <Oracle Language>_<Oracle Territory>
form.locale
- a Java Locale
instanceLocale
instancepublic static String[] getIANACharSetFromLocale(int context, Locale locale)
context
- can be EMAIL_WINDOWS
, EMAIL_UNIX
, WINDOWS
, or UNIX
locale
- Java Locale
instanceLocale
instancepublic static String[] getIANACharSetFromOraLang(int context, String oraLanguage)
context
- can be EMAIL_WINDOWS
, EMAIL_UNIX
, WINDOWS
, or UNIX
oraLanguage
- Oracle languagepublic static String[] getOraCharSetFromOraLang(int context, String oraLanguage)
context
- can be EMAIL_WINDOWS
, EMAIL_UNIX
, WINDOWS
, or UNIX
oraLanguage
- Oracle languagepublic static String getOraLinguisticSortFromLocale(Locale locale)
locale
- the localepublic static String getOraLangFromJavaLang(String lang)
Due to the limitation that uses the same ISO 639 two-letter code, zh
for Simplified Chinese and Traditional Chinese, the two languages cannot be distinguished. In fact, if zh
is given, this method returns Simplified Chinese only; it never returns Traditional Chinese.
Use the getOraLanguage(java.util.Locale)
method if those two Chinese languages need to be distinguished.
lang
- ISO 639 two-letter codepublic static String getJavaLangFromOraLang(String lang)
Due to the same reason discussed in the getOraLangFromJavaLang(java.lang.String)
method, if either Simplified Chinese or Traditional Chinese is specified, this method always returns zh
, which means loss of information.
Use the getJavaLocale(java.lang.String)
method instead.
lang
- Oracle language namepublic static String getOraTerrFromJavaTerr(String terr)
terr
- ISO 3166 two-letter codepublic static String getJavaTerrFromOraTerr(String terr)
terr
- Oracle territory name
|
Oracle® Globalization Development Kit Java API Reference 10g Release 2 (10.2) Part No. B14224-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |