use of android.icu.util.UResourceBundle in project j2objc by google.
the class TimeZoneNamesImpl method _getAvailableMetaZoneIDs.
static Set<String> _getAvailableMetaZoneIDs() {
if (METAZONE_IDS == null) {
synchronized (TimeZoneNamesImpl.class) {
if (METAZONE_IDS == null) {
UResourceBundle bundle = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, "metaZones");
UResourceBundle mapTimezones = bundle.get("mapTimezones");
Set<String> keys = mapTimezones.keySet();
METAZONE_IDS = Collections.unmodifiableSet(keys);
}
}
}
return METAZONE_IDS;
}
use of android.icu.util.UResourceBundle in project j2objc by google.
the class OlsonTimeZone method readObject.
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
if (serialVersionOnStream < 1) {
// No version - 4.2 or older
// Just reloading the rule from bundle
boolean initialized = false;
String tzid = getID();
if (tzid != null) {
try {
UResourceBundle top = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, ZONEINFORES, ICUResourceBundle.ICU_DATA_CLASS_LOADER);
UResourceBundle res = ZoneMeta.openOlsonResource(top, tzid);
construct(top, res);
if (finalZone != null) {
finalZone.setID(tzid);
}
initialized = true;
} catch (Exception ignored) {
// throw away
}
}
if (!initialized) {
// final resort
constructEmpty();
}
}
// need to rebuild transition rules when requested
transitionRulesInitialized = false;
}
use of android.icu.util.UResourceBundle in project j2objc by google.
the class OlsonTimeZone method loadRule.
private static UResourceBundle loadRule(UResourceBundle top, String ruleid) {
UResourceBundle r = top.get("Rules");
r = r.get(ruleid);
return r;
}
use of android.icu.util.UResourceBundle in project j2objc by google.
the class ICUDataVersion method getDataVersion.
/**
* This function retrieves the data version from icuver and returns a VersionInfo object with that version information.
*
* @return Current icu data version
*/
public static VersionInfo getDataVersion() {
UResourceBundle icudatares = null;
try {
icudatares = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, ICUDataVersion.U_ICU_VERSION_BUNDLE, ICUResourceBundle.ICU_DATA_CLASS_LOADER);
icudatares = icudatares.get(ICUDataVersion.U_ICU_DATA_KEY);
} catch (MissingResourceException ex) {
return null;
}
return VersionInfo.getInstance(icudatares.getString());
}
use of android.icu.util.UResourceBundle in project j2objc by google.
the class ICUResourceBundleTest method TestT6844.
/*
* UResouceBundle should be able to load a resource bundle even if
* a similarly named class (only case differences) exists in the
* same package. See Ticket#6844
*/
@Test
public void TestT6844() {
try {
UResourceBundle rb1 = UResourceBundle.getBundleInstance("android.icu.dev.data.resources.TestMessages", ULocale.getDefault(), testLoader);
assertEquals("bundleContainer in TestMessages", "TestMessages.class", rb1.getString("bundleContainer"));
UResourceBundle rb2 = UResourceBundle.getBundleInstance("android.icu.dev.data.resources.testmessages", ULocale.getDefault(), testLoader);
assertEquals("bundleContainer in testmessages", "testmessages.properties", rb2.getString("bundleContainer"));
} catch (Throwable t) {
errln(t.getMessage());
}
}
Aggregations