本文整理汇总了Java中libcore.icu.TimeZoneNames类的典型用法代码示例。如果您正苦于以下问题:Java TimeZoneNames类的具体用法?Java TimeZoneNames怎么用?Java TimeZoneNames使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TimeZoneNames类属于libcore.icu包,在下文中一共展示了TimeZoneNames类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: internalZoneStrings
import libcore.icu.TimeZoneNames; //导入依赖的package包/类
/**
* Gets zone strings, initializing them if necessary. Does not create
* a defensive copy, so make sure you do so before exposing the returned
* arrays to clients.
*/
synchronized String[][] internalZoneStrings() {
if (zoneStrings == null) {
zoneStrings = TimeZoneNames.getZoneStrings(locale);
}
return zoneStrings;
}
示例2: getTimeZoneDisplayName
import libcore.icu.TimeZoneNames; //导入依赖的package包/类
/**
* Returns the display name of the timezone specified. Returns null if no name was found in the
* zone strings.
*
* @param daylight whether to return the daylight savings or the standard name
* @param style one of the {@link TimeZone} styles such as {@link TimeZone#SHORT}
*
* @hide used internally
*/
String getTimeZoneDisplayName(TimeZone tz, boolean daylight, int style) {
if (style != TimeZone.SHORT && style != TimeZone.LONG) {
throw new IllegalArgumentException("Bad style: " + style);
}
// If custom zone strings have been set with setZoneStrings() we use those. Otherwise we
// use the ones from LocaleData.
String[][] zoneStrings = internalZoneStrings();
return TimeZoneNames.getDisplayName(zoneStrings, tz.getID(), daylight, style);
}