Java Code Examples for com.ibm.icu.util.UResourceBundle#getStringArray()

The following examples show how to use com.ibm.icu.util.UResourceBundle#getStringArray() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CalendarData.java    From fitnotifications with Apache License 2.0 6 votes vote down vote up
public String[] getDateTimePatterns(){
    ICUResourceBundle bundle = get("DateTimePatterns");
    ArrayList<String> list = new ArrayList<String>();
    UResourceBundleIterator iter = bundle.getIterator();
    while (iter.hasNext()) {
        UResourceBundle patResource = iter.next();
        int resourceType = patResource.getType();
        switch (resourceType) {
            case UResourceBundle.STRING:
                list.add(patResource.getString());
                break;
            case UResourceBundle.ARRAY:
                String[] items = patResource.getStringArray();
                list.add(items[0]);
                break;
        }
    }

    return list.toArray(new String[list.size()]);
}
 
Example 2
Source File: CalendarData.java    From fitnotifications with Apache License 2.0 6 votes vote down vote up
public String[] getOverrides(){
    ICUResourceBundle bundle = get("DateTimePatterns");
    ArrayList<String> list = new ArrayList<String>();
    UResourceBundleIterator iter = bundle.getIterator();
    while (iter.hasNext()) {
        UResourceBundle patResource = iter.next();
        int resourceType = patResource.getType();
        switch (resourceType) {
            case UResourceBundle.STRING:
                list.add(null);
                break;
            case UResourceBundle.ARRAY:
                String[] items = patResource.getStringArray();
                list.add(items[1]);
                break;
        }
    }
    return list.toArray(new String[list.size()]);
}
 
Example 3
Source File: ZoneMeta.java    From fitnotifications with Apache License 2.0 5 votes vote down vote up
private static synchronized String[] getZoneIDs() {
    if (ZONEIDS == null) {
        try {
            UResourceBundle top = UResourceBundle.getBundleInstance(
                    ICUData.ICU_BASE_NAME, ZONEINFORESNAME, ICUResourceBundle.ICU_DATA_CLASS_LOADER);
            ZONEIDS = top.getStringArray(kNAMES);
        } catch (MissingResourceException ex) {
            // throw away..
        }
    }
    if (ZONEIDS == null) {
        ZONEIDS = new String[0];
    }
    return ZONEIDS;
}