Class PrefixTimeZonesMap

java.lang.Object
com.google.i18n.phonenumbers.prefixmapper.PrefixTimeZonesMap
All Implemented Interfaces:
Externalizable, Serializable

public class PrefixTimeZonesMap extends Object implements Externalizable
A utility that maps phone number prefixes to a list of strings describing the time zones to which each prefix belongs.
See Also:
  • Constructor Details

    • PrefixTimeZonesMap

      public PrefixTimeZonesMap()
  • Method Details

    • readPrefixTimeZonesMap

      public void readPrefixTimeZonesMap(SortedMap<Integer,String> sortedPrefixTimeZoneMap)
      Creates a PrefixTimeZonesMap initialized with sortedPrefixTimeZoneMap. Note that the underlying implementation of this method is expensive thus should not be called by time-critical applications.
      Parameters:
      sortedPrefixTimeZoneMap - a map from phone number prefixes to their corresponding time zones, sorted in ascending order of the phone number prefixes as integers.
    • writeExternal

      public void writeExternal(ObjectOutput objectOutput) throws IOException
      Supports Java Serialization.
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput objectInput) throws IOException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
    • lookupTimeZonesForNumber

      public List<String> lookupTimeZonesForNumber(Phonenumber.PhoneNumber number)
      As per lookupTimeZonesForNumber(long), but receives the number as a PhoneNumber instead of a long.
      Parameters:
      number - the phone number to look up
      Returns:
      the list of corresponding time zones
    • lookupCountryLevelTimeZonesForNumber

      public List<String> lookupCountryLevelTimeZonesForNumber(Phonenumber.PhoneNumber number)
      Returns the list of time zones number's calling country code corresponds to.
      Parameters:
      number - the phone number to look up
      Returns:
      the list of corresponding time zones
    • toString

      public String toString()
      Dumps the mappings contained in the phone prefix map.
      Overrides:
      toString in class Object