src/share/classes/java/util/Currency.java

Print this page




 648             ret[i] = dis.readLong();
 649         }
 650 
 651         return ret;
 652     }
 653 
 654     private static String[] readStringArray(DataInputStream dis, int count) throws IOException {
 655         String[] ret = new String[count];
 656         for (int i = 0; i < count; i++) {
 657             ret[i] = dis.readUTF();
 658         }
 659 
 660         return ret;
 661     }
 662 
 663     /**
 664      * Replaces currency data found in the currencydata.properties file
 665      *
 666      * @param pattern regex pattern for the properties
 667      * @param ctry country code
 668      * @param data currency data.  This is a comma separated string that
 669      *    consists of "three-letter alphabet code", "three-digit numeric code",
 670      *    and "one-digit (0,1,2, or 3) default fraction digit".
 671      *    For example, "JPZ,392,0".
 672      *    An optional UTC date can be appended to the string (comma separated)
 673      *    to allow a currency change take effect after date specified.
 674      *    For example, "JP=JPZ,999,0,2014-01-01T00:00:00" has no effect unless
 675      *    UTC time is past 1st January 2014 00:00:00 GMT.
 676      */
 677     private static void replaceCurrencyData(Pattern pattern, String ctry, String curdata) {
 678 
 679         if (ctry.length() != 2) {
 680             // ignore invalid country code
 681             info("currency.properties entry for " + ctry +
 682                     " is ignored because of the invalid country code.", null);
 683             return;
 684         }
 685 
 686         Matcher m = pattern.matcher(curdata);
 687         if (!m.find() || (m.group(4) == null && countOccurrences(curdata, ',') >= 3)) {
 688             // format is not recognized.  ignore the data




 648             ret[i] = dis.readLong();
 649         }
 650 
 651         return ret;
 652     }
 653 
 654     private static String[] readStringArray(DataInputStream dis, int count) throws IOException {
 655         String[] ret = new String[count];
 656         for (int i = 0; i < count; i++) {
 657             ret[i] = dis.readUTF();
 658         }
 659 
 660         return ret;
 661     }
 662 
 663     /**
 664      * Replaces currency data found in the currencydata.properties file
 665      *
 666      * @param pattern regex pattern for the properties
 667      * @param ctry country code
 668      * @param curdata currency data.  This is a comma separated string that
 669      *    consists of "three-letter alphabet code", "three-digit numeric code",
 670      *    and "one-digit (0,1,2, or 3) default fraction digit".
 671      *    For example, "JPZ,392,0".
 672      *    An optional UTC date can be appended to the string (comma separated)
 673      *    to allow a currency change take effect after date specified.
 674      *    For example, "JP=JPZ,999,0,2014-01-01T00:00:00" has no effect unless
 675      *    UTC time is past 1st January 2014 00:00:00 GMT.
 676      */
 677     private static void replaceCurrencyData(Pattern pattern, String ctry, String curdata) {
 678 
 679         if (ctry.length() != 2) {
 680             // ignore invalid country code
 681             info("currency.properties entry for " + ctry +
 682                     " is ignored because of the invalid country code.", null);
 683             return;
 684         }
 685 
 686         Matcher m = pattern.matcher(curdata);
 687         if (!m.find() || (m.group(4) == null && countOccurrences(curdata, ',') >= 3)) {
 688             // format is not recognized.  ignore the data