|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.util.LocaleUtilities
LocaleUtilities provides utility methods for working with Locales.
Supported API: true
Extendable: false
Locale
Field Summary | |
private static Hashtable |
cvEncodings
|
static String |
LOCALE_CHARSET_PROPERTY
|
private static Locale[] |
supportedLocales
|
private static byte[] |
UTF8_BOM
|
Constructor Summary | |
LocaleUtilities()
|
Method Summary | |
static String |
getDefaultEncoding()
Gets the default file encoding. |
static String |
getEncoding(Locale locale)
Gets the localized file encoding for the locale. |
static String |
getEncoding(Locale locale,
String file_name)
Gets the localized file encoding for the locale code. |
static String |
getEncoding(String locale_code)
Gets the localized file encoding for the locale code. |
static String |
getEncoding(String base_property,
Locale locale)
Gets the localized file encoding for the locale. |
static String |
getEncoding(String base_property,
Locale locale,
String file_name)
Gets the localized file encoding for the locale code. |
static String |
getEncoding(String base_property,
String locale_code)
Gets the localized file encoding for the locale code. |
static String |
getEncoding(String base_property,
String locale_code,
String file_name)
Gets the localized file encoding for the locale code. |
static Locale[] |
getSupportedLocales()
Gets the array of supported Locales, as defined by the wt.locale.set property in wt.properties. |
static boolean |
hasUTF8ByteOrderMark(String file_name)
Determine if a file has a UTF-8 byte order mark. |
static Locale |
makeLocale(String locale)
Construct a Locale instance for the locale String. |
static Locale |
makeLocale(String[] args,
int startIndex)
Construct a Locale instance for the args String array. |
static Locale[] |
makeLocales(String delimitedlist,
String separators)
Construct an array of Locales, based on a delimited String. |
static String |
toString(Locale[] locales)
Construct a String that represents the contents of an array of Locales. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String LOCALE_CHARSET_PROPERTY
private static Locale[] supportedLocales
private static Hashtable cvEncodings
private static final byte[] UTF8_BOM
Constructor Detail |
public LocaleUtilities()
Method Detail |
public static boolean hasUTF8ByteOrderMark(String file_name) throws IOException
IOException
public static String getEncoding(Locale locale, String file_name) throws IOException
LOCALE_CHARSET_PROPERTY
,
if not embedded in the file.
locale
- - the locale for which encoding is neededfile_name
- - name of file to check
IOException
HtmlUtil
public static String getEncoding(String base_property, Locale locale, String file_name) throws IOException
base_property
- - the base property name to uselocale
- - the locale for which encoding is neededfile_name
- - name of file to check
IOException
HtmlUtil
public static String getEncoding(String base_property, String locale_code, String file_name) throws IOException
base_property
- - the base property name to uselocale_code
- - the locale code for which encoding is neededfile_name
- - name of file for which encoding is needed
IOException
HtmlUtil
public static String getDefaultEncoding()
HtmlUtil
public static String getEncoding(String locale_code)
LOCALE_CHARSET_PROPERTY
.
locale_code
- - the locale code for which encoding is needed
LOCALE_CHARSET_PROPERTY
,
HtmlUtil
public static String getEncoding(String base_property, String locale_code)
base_property
- - the base property name to uselocale_code
- - the locale code for which encoding is needed
HtmlUtil
public static String getEncoding(String base_property, Locale locale)
base_property
- - the base property name to uselocale
- - the Locale for which encoding is needed
HtmlUtil
public static String getEncoding(Locale locale)
LOCALE_CHARSET_PROPERTY
.
locale
- - the Locale for which encoding is needed
LOCALE_CHARSET_PROPERTY
,
HtmlUtil
public static Locale[] getSupportedLocales()
public static Locale makeLocale(String[] args, int startIndex)
Example Usage: LocaleUtilities.makeLocale( ["xyz","fr"], 1 ) // returns fr Locale LocaleUtilities.makeLocale( ["fr","CA"], 0 ) // returns fr_CA Locale
args
- - series of Strings that, starting at the specified index, represent a LocalestartIndex
- - the index of the array that begins Locale specification
public static Locale makeLocale(String locale)
Example Usage: LocaleUtilities.makeLocale( "fr" ) // returns fr Locale LocaleUtilities.makeLocale( "fr_CA" ) // returns fr_CA Locale
locale
- - the String representation of a Locale
public static Locale[] makeLocales(String delimitedlist, String separators)
Example Usage: LocaleUtilities.makeLocales( "fr,de", "," ) // returns [fr,de] LocaleUtilities.makeLocales( "fr_CA,de", "," ) // returns [fr_CA,de] LocaleUtilities.makeLocales( "fr_CA,de", ",_" ) // returns [fr,CA,de]
delimitedlist
- - the String to convertseparators
- - the separators to consider
public static String toString(Locale[] locales)
Example Usage: LocaleUtilities.toString( [fr,de] ) // returns "fr,de" LocaleUtilities.toString( [fr_CA,de] ) // returns "fr_CA,de" LocaleUtilities.toString( [fr,CA,de] ) // returns "fr,CA,de"
locales
- - an array of Locale objects
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |