コード例 #1
0
 private static PrefixTimeZonesMap loadPrefixTimeZonesMapFromFile(String path) {
   InputStream source = PhoneNumberToTimeZonesMapper.class.getResourceAsStream(path);
   ObjectInputStream in = null;
   PrefixTimeZonesMap map = new PrefixTimeZonesMap();
   try {
     in = new ObjectInputStream(source);
     map.readExternal(in);
   } catch (IOException e) {
     LOGGER.log(Level.WARNING, e.toString());
   } finally {
     close(in);
   }
   return map;
 }
コード例 #2
0
 /**
  * Returns the list of time zones corresponding to the country calling code of {@code number}.
  *
  * @param number the phone number to look up
  * @return the list of corresponding time zones or a single element list with the default unknown
  *     time zone if no other time zone was found
  */
 private List<String> getCountryLevelTimeZonesforNumber(PhoneNumber number) {
   List<String> timezones = prefixTimeZonesMap.lookupCountryLevelTimeZonesForNumber(number);
   return Collections.unmodifiableList(timezones.isEmpty() ? UNKNOWN_TIME_ZONE_LIST : timezones);
 }