com.google.i18n.phonenumbers.geocoding
Class AreaCodeMap

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

public class AreaCodeMap
extends Object
implements Externalizable

A utility that maps phone number prefixes to a string describing the geographical area the prefix covers.

Author:
Shaopeng Jia
See Also:
Serialized Form

Constructor Summary
AreaCodeMap()
          Creates an empty AreaCodeMap.
 
Method Summary
 void readAreaCodeMap(SortedMap<Integer,String> sortedAreaCodeMap)
          Creates an AreaCodeMap initialized with sortedAreaCodeMap.
 void readExternal(ObjectInput objectInput)
          Supports Java Serialization.
 String toString()
          Dumps the mappings contained in the area code map.
 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

AreaCodeMap

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

Method Detail

readAreaCodeMap

public void readAreaCodeMap(SortedMap<Integer,String> sortedAreaCodeMap)
Creates an AreaCodeMap initialized with sortedAreaCodeMap. Note that the underlying implementation of this method is expensive thus should not be called by time-critical applications.

Parameters:
sortedAreaCodeMap - a map from phone number prefixes to descriptions of corresponding geographical areas, sorted in ascending order of the phone number prefixes 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()
Dumps the mappings contained in the area code map.

Overrides:
toString in class Object


Copyright © 2012 Google. All Rights Reserved.