|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.poi.util.LocaleUtil
public final class LocaleUtil
This utility class is used to set locale and time zone settings beside
of the JDK internal Locale.setDefault(Locale)
and
TimeZone.setDefault(TimeZone)
methods, because
the locale/time zone specific handling of certain office documents -
maybe for different time zones / locales ... - shouldn't affect
other java components.
The settings are saved in a ThreadLocal
,
so they only apply to the current thread and can't be set globally.
Field Summary | |
---|---|
static java.nio.charset.Charset |
CHARSET_1252
Default encoding for unknown byte encodings of native files (at least it's better than to rely on a platform dependent encoding for legacy stuff ...) |
static java.util.TimeZone |
TIMEZONE_UTC
Excel doesn't store TimeZone information in the file, so if in doubt, use UTC to perform calculations |
Method Summary | |
---|---|
static java.util.Calendar |
getLocaleCalendar()
|
static java.util.Calendar |
getLocaleCalendar(int year,
int month,
int day)
Convenience method - month is 0-based as in java.util.Calendar |
static java.util.Calendar |
getLocaleCalendar(int year,
int month,
int day,
int hour,
int minute,
int second)
Convenience method - month is 0-based as in java.util.Calendar |
static java.util.Calendar |
getLocaleCalendar(java.util.TimeZone timeZone)
|
static java.lang.String |
getLocaleFromLCID(int lcid)
Decode the language ID from LCID value |
static java.util.Locale |
getUserLocale()
|
static java.util.TimeZone |
getUserTimeZone()
|
static void |
resetUserLocale()
|
static void |
resetUserTimeZone()
Clear the thread-local user time zone. |
static void |
setUserLocale(java.util.Locale locale)
Sets default user locale. |
static void |
setUserTimeZone(java.util.TimeZone timezone)
As time zone information is not stored in any format, it can be set before any date calculations take place. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.util.TimeZone TIMEZONE_UTC
public static final java.nio.charset.Charset CHARSET_1252
Method Detail |
---|
public static void setUserTimeZone(java.util.TimeZone timezone)
timezone
- the timezone under which date calculations take placepublic static java.util.TimeZone getUserTimeZone()
TimeZone.getDefault()
.public static void resetUserTimeZone()
public static void setUserLocale(java.util.Locale locale)
public static java.util.Locale getUserLocale()
Locale.getDefault()
.public static void resetUserLocale()
public static java.util.Calendar getLocaleCalendar()
public static java.util.Calendar getLocaleCalendar(int year, int month, int day)
year
- month
- day
-
public static java.util.Calendar getLocaleCalendar(int year, int month, int day, int hour, int minute, int second)
year
- month
- day
- hour
- minute
- second
-
public static java.util.Calendar getLocaleCalendar(java.util.TimeZone timeZone)
public static java.lang.String getLocaleFromLCID(int lcid)
lcid
- the LCID value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |