Package com.ibm.icu.util

Examples of com.ibm.icu.util.UResourceBundle


    }
   
    PerfTest.Function TestGetMinusOneUintICU(){
        return new PerfTest.Function(){
            public void call(){
                UResourceBundle sub = icuRes.get("minusone");
                int t = sub.getUInt();
                if (t != 0xFFFFFFF) throw new Error("not equal");
            }
        };
    }
View Full Code Here


        GetIntIcu(String key, int expected) {
            this.key = key;
            this.expected = expected;
        }
        public void call() {
            UResourceBundle temp = icuRes.get(key);
            int t = temp.getInt();
            if (t != expected) throw new Error("not equal");
        }
View Full Code Here

        GetIvIcu(String key, int[] expected) {
            this.key = key;
            this.expected = expected;
        }
        public void call() {
            UResourceBundle temp = icuRes.get(key);
            int[] iv = temp.getIntVector();
            for (int i = 0; i < iv.length; i++){
                if (expected[i] != iv[i]) throw new Error("not equal");
            }
        }
View Full Code Here

        GetBinaryIcu(String key, int expected_len) {
            this.key = key;
            this.expected_len = expected_len;
        }
        public void call() {
            UResourceBundle temp = icuRes.get(key);
            ByteBuffer got = temp.getBinary();
            if(got.remaining() != expected_len) throw new Error("not the expected len");
            for(int i=0; i< got.remaining(); i++){
              byte b = got.get();
              if (i != b) throw new Error("not equal");
            }
View Full Code Here

            this.key = key;
            this.expected = expected;
        }
        public void call() {
            int p = 0;
            UResourceBundle menus = icuRes.get(key);
            int sizei = menus.getSize();
            for (int i=0; i<sizei; i++){
                UResourceBundle menu = menus.get(i);
                String menu_name = menu.getKey();
                if (!expected[p++].equals(menu_name)) throw new Error("not equal");
               
                int sizej = menu.getSize();
                for (int j=0; j< sizej; j++){
                    UResourceBundle menu_item = menu.get(j);
                    String itemKey = menu_item.getKey();
                    String value = menu_item.getString();
                    if(!expected[p++].equals(itemKey)) throw new Error("not equal");
                    if(!expected[p++].equals(value)) throw new Error("not equal");
                }
            }
           
View Full Code Here

        return getFromTable(res, key, new int[]{expResType});
    }
   
    static UResourceBundle getFromTable(UResourceBundle res, String key, int[] expResTypes) throws DataModuleFormatError{
        assert_is (res != null && key != null && res.getType() == UResourceBundle.TABLE);
        UResourceBundle t = res.get(key);
     
        assert_not (t ==null);
        int type = t.getType();
        Arrays.sort(expResTypes);
        if (Arrays.binarySearch(expResTypes, type) >= 0) {
            return t;
        } else {
//#if defined(FOUNDATION10) || defined(J2SE13)
//##            throw new DataModuleFormatError("Actual type " + t.getType() + " != expected types " + expResTypes + ".");
//#else
            throw new DataModuleFormatError(new UResourceTypeMismatchException("Actual type " + t.getType() + " != expected types " + expResTypes + "."));
//#endif
        }
    }
View Full Code Here

    /**
     * Unfortunately, UResourceBundle is unable to treat one string as string array.
     * This function return a String[] from UResourceBundle, regardless it is an array or a string
     */
    static String[] getStringArrayHelper(UResourceBundle res, String key) throws DataModuleFormatError{
        UResourceBundle t = getFromTable(res, key, new int[]{UResourceBundle.ARRAY, UResourceBundle.STRING});
        return getStringArrayHelper(t);
    }
View Full Code Here

        }
        public boolean hasNext() {
            if (isStrRes) return hasNextForStrRes();
           
            if (preparedNextElement != null) return true;
            UResourceBundle t = null;
            if (itr.hasNext()) {
                // Notice, other RuntimeException may be throwed
                t = itr.next();
            } else {
                return false;
View Full Code Here

           
        }
       
        public String getString(String key) {
            Object o = theMap.get(key);
            UResourceBundle rb;
            if(o instanceof UResourceBundle) {
                // unpack ResourceBundle strings
                rb = (UResourceBundle)o;
                return rb.getString();
            }
            return (String)o;
        }
View Full Code Here

   * @return the number of zones in the equivalency group containing 'id', or zero if there are no equivalent zones.
   * @see #getEquivalentID
   */
  public static synchronized int countEquivalentIDs(String id) {
    int count = 0;
    UResourceBundle res = openOlsonResource(null, id);
    if (res != null) {
      try {
        UResourceBundle links = res.get("links");
        int[] v = links.getIntVector();
        count = v.length;
      } catch (MissingResourceException ex) {
        // throw away
      }
    }
View Full Code Here

TOP

Related Classes of com.ibm.icu.util.UResourceBundle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.