com.google.i18n.phonenumbers.geocoding
Class MappingFileProvider

java.lang.Object
  extended by com.google.i18n.phonenumbers.geocoding.MappingFileProvider
All Implemented Interfaces:
Externalizable, Serializable

public class MappingFileProvider
extends Object
implements Externalizable

A utility which knows the data files that are available for the geocoder to use. The data files contain mappings from phone number prefixes to text descriptions, and are organized by country calling code and language that the text descriptions are in.

Author:
Shaopeng Jia
See Also:
Serialized Form

Constructor Summary
MappingFileProvider()
          Creates an empty MappingFileProvider.
 
Method Summary
 void readExternal(ObjectInput objectInput)
          Supports Java Serialization.
 void readFileConfigs(SortedMap<Integer,Set<String>> availableDataFiles)
          Initializes an MappingFileProvider with availableDataFiles.
 String toString()
          Returns a string representing the data in this class.
 void writeExternal(ObjectOutput objectOutput)
          Supports Java Serialization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MappingFileProvider

public MappingFileProvider()
Creates an empty MappingFileProvider. The default constructor is necessary for implementing Externalizable. The empty provider could later be populated by readFileConfigs(java.util.SortedMap) or readExternal(java.io.ObjectInput).

Method Detail

readFileConfigs

public void readFileConfigs(SortedMap<Integer,Set<String>> availableDataFiles)
Initializes an MappingFileProvider with availableDataFiles.

Parameters:
availableDataFiles - a map from country calling codes to sets of languages in which data files are available for the specific country calling code. The map is sorted in ascending order of the country calling codes as integers.

readExternal

public void readExternal(ObjectInput objectInput)
                  throws IOException
Supports Java Serialization.

Specified by:
readExternal in interface Externalizable
Throws:
IOException

writeExternal

public void writeExternal(ObjectOutput objectOutput)
                   throws IOException
Supports Java Serialization.

Specified by:
writeExternal in interface Externalizable
Throws:
IOException

toString

public String toString()
Returns a string representing the data in this class. The string contains one line for each country calling code. The country calling code is followed by a '|' and then a list of comma-separated languages sorted in ascending order.

Overrides:
toString in class Object


Copyright © 2012 Google. All Rights Reserved.