Package com.google.i18n.phonenumbers.Phonemetadata

Examples of com.google.i18n.phonenumbers.Phonemetadata.PhoneMetadataCollection


    InputStream source =
        PhoneNumberUtil.class.getResourceAsStream(filePrefix + "_" + regionCode);
    ObjectInputStream in;
    try {
      in = new ObjectInputStream(source);
      PhoneMetadataCollection metadataCollection = new PhoneMetadataCollection();
      metadataCollection.readExternal(in);
      for (PhoneMetadata metadata : metadataCollection.getMetadataList()) {
        countryToMetadataMap.put(regionCode, metadata);
      }
    } catch (IOException e) {
      LOGGER.log(Level.WARNING, e.toString());
    }
View Full Code Here


      filePrefix = outputDir + PhoneNumberUtilTest.TEST_META_DATA_FILE_PREFIX;
    } else {
      filePrefix = outputDir + PhoneNumberUtil.META_DATA_FILE_PREFIX;
    }

    PhoneMetadataCollection metadataCollection =
        BuildMetadataFromXml.buildPhoneMetadataCollection(inputFile, liteBuild);

    for (PhoneMetadata metadata : metadataCollection.getMetadataList()) {
      String regionCode = metadata.getId();
      PhoneMetadataCollection outMetadataCollection = new PhoneMetadataCollection();
      outMetadataCollection.addMetadata(metadata);
      FileOutputStream outputForRegion = new FileOutputStream(filePrefix + "_" + regionCode);
      ObjectOutputStream out = new ObjectOutputStream(outputForRegion);
      outMetadataCollection.writeExternal(out);
      out.close();
    }

    Map<Integer, List<String>> countryCodeToRegionCodeMap =
        BuildMetadataFromXml.buildCountryCodeToRegionCodeMap(metadataCollection);
View Full Code Here

    File xmlFile = new File(inputXmlFile);
    Document document = builder.parse(xmlFile);
    document.getDocumentElement().normalize();
    Element rootElement = document.getDocumentElement();
    NodeList territory = rootElement.getElementsByTagName("territory");
    PhoneMetadataCollection metadataCollection = new PhoneMetadataCollection();
    int numOfTerritories = territory.getLength();
    for (int i = 0; i < numOfTerritories; i++) {
      Element territoryElement = (Element) territory.item(i);
      String regionCode = territoryElement.getAttribute("id");
      PhoneMetadata metadata = loadCountryMetadata(regionCode, territoryElement);
      metadataCollection.addMetadata(metadata);
    }
    return metadataCollection;
  }
View Full Code Here

    }
    String inputFile = args[0];
    String outputFile = args[1];
    boolean liteBuild = args.length > 2 && args[2].equals("true");

    PhoneMetadataCollection metadataCollection =
        BuildMetadataFromXml.buildPhoneMetadataCollection(inputFile, liteBuild);
    Map<Integer, List<String>> countryCodeToRegionCodeMap =
        BuildMetadataFromXml.buildCountryCodeToRegionCodeMap(metadataCollection);

    BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile));
View Full Code Here

TOP

Related Classes of com.google.i18n.phonenumbers.Phonemetadata.PhoneMetadataCollection

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.