Package com.google.i18n.phonenumbers.prefixmapper

Examples of com.google.i18n.phonenumbers.prefixmapper.PrefixTimeZonesMap


  }

  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);
    }
View Full Code Here


   */
  // @VisibleForTesting
  static void writeToBinaryFile(SortedMap<Integer, String> sortedMap, OutputStream output)
      throws IOException {
    // Build the corresponding PrefixTimeZonesMap and serialize it to the binary format.
    PrefixTimeZonesMap prefixTimeZonesMap = new PrefixTimeZonesMap();
    prefixTimeZonesMap.readPrefixTimeZonesMap(sortedMap);
    ObjectOutputStream objectOutputStream = new ObjectOutputStream(output);
    prefixTimeZonesMap.writeExternal(objectOutputStream);
    objectOutputStream.flush();
  }
View Full Code Here

    SortedMap<Integer, String> prefixTimeZonesMapping = parseTextFileHelper(input);
    GenerateTimeZonesMapData.writeToBinaryFile(prefixTimeZonesMapping, byteArrayOutputStream);
    // The byte array output stream now contains the corresponding serialized prefix to time zones
    // map. Try to deserialize it and compare it with the initial input.
    PrefixTimeZonesMap prefixTimeZonesMap = new PrefixTimeZonesMap();
    prefixTimeZonesMap.readExternal(
        new ObjectInputStream(new ByteArrayInputStream(byteArrayOutputStream.toByteArray())));

    return prefixTimeZonesMap.toString();
  }
View Full Code Here

TOP

Related Classes of com.google.i18n.phonenumbers.prefixmapper.PrefixTimeZonesMap

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.