Package com.google.i18n.phonenumbers.prefixmapper

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


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


    SortedMap<Integer, String> phonePrefixMappings =
        GeneratePhonePrefixData.readMappingsFromTextFile(byteArrayInputStream);
    GeneratePhonePrefixData.writeToBinaryFile(phonePrefixMappings, byteArrayOutputStream);
    // The byte array output stream now contains the corresponding serialized phone prefix map. Try
    // to deserialize it and compare it with the initial input.
    PhonePrefixMap phonePrefixMap = new PhonePrefixMap();
    phonePrefixMap.readExternal(
        new ObjectInputStream(new ByteArrayInputStream(byteArrayOutputStream.toByteArray())));

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

TOP

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

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.