Class TimeZoneFormat

All Implemented Interfaces:
Freezable<TimeZoneFormat>, Serializable, Cloneable

public class TimeZoneFormat extends UFormat implements Freezable<TimeZoneFormat>, Serializable
TimeZoneFormat supports time zone display name formatting and parsing. An instance of TimeZoneFormat works as a subformatter of SimpleDateFormat, but you can also directly get a new instance of TimeZoneFormat and formatting/parsing time zone display names.

ICU implements the time zone display names defined by UTS#35 Unicode Locale Data Markup Language (LDML). TimeZoneNames represents the time zone display name data model and this class implements the algorithm for actual formatting and parsing.

See Also:
  • Field Details

  • Constructor Details

    • TimeZoneFormat

      protected TimeZoneFormat(ULocale locale)
      The protected constructor for subclassing.
      Parameters:
      locale - the locale
  • Method Details

    • getInstance

      public static TimeZoneFormat getInstance(ULocale locale)
      Returns a frozen instance of TimeZoneFormat for the given locale.

      Note: The instance returned by this method is frozen. If you want to customize a TimeZoneFormat, you must use cloneAsThawed() to get a thawed copy first.

      Parameters:
      locale - the locale.
      Returns:
      a frozen instance of TimeZoneFormat for the given locale.
    • getInstance

      public static TimeZoneFormat getInstance(Locale locale)
      Returns a frozen instance of TimeZoneFormat for the given Locale.

      Note: The instance returned by this method is frozen. If you want to customize a TimeZoneFormat, you must use cloneAsThawed() to get a thawed copy first.

      Parameters:
      locale - the Locale.
      Returns:
      a frozen instance of TimeZoneFormat for the given locale.
    • getTimeZoneNames

      public TimeZoneNames getTimeZoneNames()
      Returns the time zone display name data used by this instance.
      Returns:
      the time zone display name data.
      See Also:
    • getTimeZoneGenericNames

      private TimeZoneGenericNames getTimeZoneGenericNames()
      Private method returning the instance of TimeZoneGenericNames used by this object. The instance of TimeZoneGenericNames might not be available until the first use (lazy instantiation) because it is only required for handling generic names (that are not used by DateFormat's default patterns) and it requires relatively heavy one time initialization.
      Returns:
      the instance of TimeZoneGenericNames used by this object.
    • getTZDBTimeZoneNames

      private TimeZoneNames getTZDBTimeZoneNames()
      Private method returning the instance of TZDBTimeZoneNames. The instance if used only for parsing when TimeZoneFormat.ParseOption.TZ_DATABASE_ABBREVIATIONS is enabled.
      Returns:
      an instance of TZDBTimeZoneNames.
    • setTimeZoneNames

      public TimeZoneFormat setTimeZoneNames(TimeZoneNames tznames)
      Sets the time zone display name data to this instance.
      Parameters:
      tznames - the time zone display name data.
      Returns:
      this object.
      Throws:
      UnsupportedOperationException - when this object is frozen.
      See Also:
    • getGMTPattern

      public String getGMTPattern()
      Returns the localized GMT format pattern.
      Returns:
      the localized GMT format pattern.
      See Also:
    • setGMTPattern

      public TimeZoneFormat setGMTPattern(String pattern)
      Sets the localized GMT format pattern. The pattern must contain a single argument {0}, for example "GMT {0}".
      Parameters:
      pattern - the localized GMT format pattern string
      Returns:
      this object.
      Throws:
      IllegalArgumentException - when the pattern string does not contain "{0}"
      UnsupportedOperationException - when this object is frozen.
      See Also:
    • getGMTOffsetPattern

      public String getGMTOffsetPattern(TimeZoneFormat.GMTOffsetPatternType type)
      Returns the offset pattern used for localized GMT format.
      Parameters:
      type - the offset pattern enum
      See Also:
    • setGMTOffsetPattern

      public TimeZoneFormat setGMTOffsetPattern(TimeZoneFormat.GMTOffsetPatternType type, String pattern)
      Sets the offset pattern for the given offset type.
      Parameters:
      type - the offset pattern.
      pattern - the pattern string.
      Returns:
      this object.
      Throws:
      IllegalArgumentException - when the pattern string does not have required time field letters.
      UnsupportedOperationException - when this object is frozen.
      See Also:
    • getGMTOffsetDigits

      public String getGMTOffsetDigits()
      Returns the decimal digit characters used for localized GMT format in a single string containing from 0 to 9 in the ascending order.
      Returns:
      the decimal digits for localized GMT format.
      See Also:
    • setGMTOffsetDigits

      public TimeZoneFormat setGMTOffsetDigits(String digits)
      Sets the decimal digit characters used for localized GMT format.
      Parameters:
      digits - a string contains the decimal digit characters from 0 to 9 n the ascending order.
      Returns:
      this object.
      Throws:
      IllegalArgumentException - when the string did not contain ten characters.
      UnsupportedOperationException - when this object is frozen.
      See Also:
    • getGMTZeroFormat

      public String getGMTZeroFormat()
      Returns the localized GMT format string for GMT(UTC) itself (GMT offset is 0).
      Returns:
      the localized GMT string string for GMT(UTC) itself.
      See Also:
    • setGMTZeroFormat

      public TimeZoneFormat setGMTZeroFormat(String gmtZeroFormat)
      Sets the localized GMT format string for GMT(UTC) itself (GMT offset is 0).
      Parameters:
      gmtZeroFormat - the localized GMT format string for GMT(UTC).
      Returns:
      this object.
      Throws:
      UnsupportedOperationException - when this object is frozen.
      See Also:
    • setDefaultParseOptions

      public TimeZoneFormat setDefaultParseOptions(EnumSet<TimeZoneFormat.ParseOption> options)
      Sets the default parse options.

      Note: By default, an instance of TimeZoneFormat created by getInstance(ULocale) has no parse options set.

      Parameters:
      options - the default parse options.
      Returns:
      this object.
      See Also:
    • getDefaultParseOptions

      public EnumSet<TimeZoneFormat.ParseOption> getDefaultParseOptions()
      Returns the default parse options used by this TimeZoneFormat instance.
      Returns:
      the default parse options.
      See Also:
    • formatOffsetISO8601Basic

      public final String formatOffsetISO8601Basic(int offset, boolean useUtcIndicator, boolean isShort, boolean ignoreSeconds)
      Returns the ISO 8601 basic time zone string for the given offset. For example, "-08", "-0830" and "Z"
      Parameters:
      offset - the offset from GMT(UTC) in milliseconds.
      useUtcIndicator - true if ISO 8601 UTC indicator "Z" is used when the offset is 0.
      isShort - true if shortest form is used.
      ignoreSeconds - true if non-zero offset seconds is appended.
      Returns:
      the ISO 8601 basic format.
      Throws:
      IllegalArgumentException - if the specified offset is out of supported range (-24 hours < offset < +24 hours).
      See Also:
    • formatOffsetISO8601Extended

      public final String formatOffsetISO8601Extended(int offset, boolean useUtcIndicator, boolean isShort, boolean ignoreSeconds)
      Returns the ISO 8601 extended time zone string for the given offset. For example, "-08:00", "-08:30" and "Z"
      Parameters:
      offset - the offset from GMT(UTC) in milliseconds.
      useUtcIndicator - true if ISO 8601 UTC indicator "Z" is used when the offset is 0.
      isShort - true if shortest form is used.
      ignoreSeconds - true if non-zero offset seconds is appended.
      Returns:
      the ISO 8601 extended format.
      Throws:
      IllegalArgumentException - if the specified offset is out of supported range (-24 hours < offset < +24 hours).
      See Also:
    • formatOffsetLocalizedGMT

      public String formatOffsetLocalizedGMT(int offset)
      Returns the localized GMT(UTC) offset format for the given offset. The localized GMT offset is defined by; This format always uses 2 digit hours and minutes. When the given offset has non-zero seconds, 2 digit seconds field will be appended. For example, GMT+05:00 and GMT+05:28:06.
      Parameters:
      offset - the offset from GMT(UTC) in milliseconds.
      Returns:
      the localized GMT format string
      Throws:
      IllegalArgumentException - if the specified offset is out of supported range (-24 hours < offset < +24 hours).
      See Also:
    • formatOffsetShortLocalizedGMT

      public String formatOffsetShortLocalizedGMT(int offset)
      Returns the short localized GMT(UTC) offset format for the given offset. The short localized GMT offset is defined by; This format uses the shortest representation of offset. The hours field does not have leading zero and lower fields with zero will be truncated. For example, GMT+5 and GMT+530.
      Parameters:
      offset - the offset from GMT(UTC) in milliseconds.
      Returns:
      the short localized GMT format string
      Throws:
      IllegalArgumentException - if the specified offset is out of supported range (-24 hours < offset < +24 hours).
      See Also:
    • format

      public final String format(TimeZoneFormat.Style style, TimeZone tz, long date)
      Returns the display name of the time zone at the given date for the style.

      Note: A style may have fallback styles defined. For example, when GENERIC_LONG is requested, but there is no display name data available for GENERIC_LONG style, the implementation may use GENERIC_LOCATION or LOCALIZED_GMT. See UTS#35 UNICODE LOCALE DATA MARKUP LANGUAGE (LDML) Appendix J: Time Zone Display Name for the details.

      Parameters:
      style - the style enum (e.g. GENERIC_LONG, LOCALIZED_GMT...)
      tz - the time zone.
      date - the date.
      Returns:
      the display name of the time zone.
      See Also:
    • format

      public String format(TimeZoneFormat.Style style, TimeZone tz, long date, Output<TimeZoneFormat.TimeType> timeType)
      Returns the display name of the time zone at the given date for the style. This method takes an extra argument Output<TimeType> timeType in addition to the argument list of format(Style, TimeZone, long). The argument is used for receiving the time type (standard time or daylight saving time, or unknown) actually used for the display name.
      Parameters:
      style - the style enum (e.g. GENERIC_LONG, LOCALIZED_GMT...)
      tz - the time zone.
      date - the date.
      timeType - the output argument for receiving the time type (standard/daylight/unknown) used for the display name, or specify null if the information is not necessary.
      Returns:
      the display name of the time zone.
      See Also:
    • parseOffsetISO8601

      public final int parseOffsetISO8601(String text, ParsePosition pos)
      Returns offset from GMT(UTC) in milliseconds for the given ISO 8601 basic or extended time zone string. When the given string is not an ISO 8601 time zone string, this method sets the current position as the error index to ParsePosition pos and returns 0.
      Parameters:
      text - the text contains ISO 8601 style time zone string (e.g. "-08", "-0800", "-08:00", and "Z") at the position.
      pos - the position.
      Returns:
      the offset from GMT(UTC) in milliseconds for the given ISO 8601 style time zone string.
      See Also:
    • parseOffsetLocalizedGMT

      public int parseOffsetLocalizedGMT(String text, ParsePosition pos)
      Returns offset from GMT(UTC) in milliseconds for the given localized GMT offset format string. When the given string cannot be parsed, this method sets the current position as the error index to ParsePosition pos and returns 0.
      Parameters:
      text - the text contains a localized GMT offset string at the position.
      pos - the position.
      Returns:
      the offset from GMT(UTC) in milliseconds for the given localized GMT offset format string.
      See Also:
    • parseOffsetShortLocalizedGMT

      public int parseOffsetShortLocalizedGMT(String text, ParsePosition pos)
      Returns offset from GMT(UTC) in milliseconds for the given short localized GMT offset format string. When the given string cannot be parsed, this method sets the current position as the error index to ParsePosition pos and returns 0.
      Parameters:
      text - the text contains a short localized GMT offset string at the position.
      pos - the position.
      Returns:
      the offset from GMT(UTC) in milliseconds for the given short localized GMT offset format string.
      See Also:
    • parse

      Returns a TimeZone by parsing the time zone string according to the parse position, the style and the parse options.
      Parameters:
      text - the text contains a time zone string at the position.
      style - the format style.
      pos - the position.
      options - the parse options.
      timeType - The output argument for receiving the time type (standard/daylight/unknown), or specify null if the information is not necessary.
      Returns:
      A TimeZone, or null if the input could not be parsed.
      See Also:
    • parse

      public TimeZone parse(TimeZoneFormat.Style style, String text, ParsePosition pos, Output<TimeZoneFormat.TimeType> timeType)
      Returns a TimeZone by parsing the time zone string according to the parse position, the style and the default parse options.

      Note: This method is equivalent to parse(style, text, pos, null, timeType).

      Parameters:
      text - the text contains a time zone string at the position.
      style - the format style
      pos - the position.
      timeType - The output argument for receiving the time type (standard/daylight/unknown), or specify null if the information is not necessary.
      Returns:
      A TimeZone, or null if the input could not be parsed.
      See Also:
    • parse

      public final TimeZone parse(String text, ParsePosition pos)
      Returns a TimeZone by parsing the time zone string according to the given parse position.

      Note: This method is equivalent to parse(Style.GENERIC_LOCATION, text, pos, EnumSet.of(ParseOption.ALL_STYLES), timeType).

      Parameters:
      text - the text contains a time zone string at the position.
      pos - the position.
      Returns:
      A TimeZone, or null if the input could not be parsed.
      See Also:
    • parse

      public final TimeZone parse(String text) throws ParseException
      Returns a TimeZone for the given text.

      Note: The behavior of this method is equivalent to parse(String, ParsePosition).

      Parameters:
      text - the time zone string
      Returns:
      A TimeZone.
      Throws:
      ParseException - when the input could not be parsed as a time zone string.
      See Also:
    • format

      public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
      Specified by:
      format in class Format
    • formatToCharacterIterator

      public AttributedCharacterIterator formatToCharacterIterator(Object obj)
      Overrides:
      formatToCharacterIterator in class Format
    • parseObject

      public Object parseObject(String source, ParsePosition pos)
      Specified by:
      parseObject in class Format
    • formatOffsetLocalizedGMT

      private String formatOffsetLocalizedGMT(int offset, boolean isShort)
      Private method used for localized GMT formatting.
      Parameters:
      offset - the zone's UTC offset
      isShort - true if the short localized GMT format is desired
      Returns:
      the localized GMT string
    • formatOffsetISO8601

      private String formatOffsetISO8601(int offset, boolean isBasic, boolean useUtcIndicator, boolean isShort, boolean ignoreSeconds)
    • formatSpecific

      private String formatSpecific(TimeZone tz, TimeZoneNames.NameType stdType, TimeZoneNames.NameType dstType, long date, Output<TimeZoneFormat.TimeType> timeType)
      Private method returning the time zone's specific format string.
      Parameters:
      tz - the time zone
      stdType - the name type used for standard time
      dstType - the name type used for daylight time
      date - the date
      timeType - when null, actual time type is set
      Returns:
      the time zone's specific format name string
    • formatExemplarLocation

      private String formatExemplarLocation(TimeZone tz)
      Private method returning the time zone's exemplar location string. This method will never return null.
      Parameters:
      tz - the time zone
      Returns:
      the time zone's exemplar location name.
    • getTimeZoneID

      private String getTimeZoneID(String tzID, String mzID)
      Private method returns a time zone ID. If tzID is not null, the value of tzID is returned. If tzID is null, then this method look up a time zone ID for the current region. This is a small helper method used by the parse implementation method
      Parameters:
      tzID - the time zone ID or null
      mzID - the meta zone ID or null
      Returns:
      A time zone ID
      Throws:
      IllegalArgumentException - when both tzID and mzID are null
    • getTargetRegion

      private String getTargetRegion()
      Private method returning the target region. The target regions is determined by the locale of this instance. When a generic name is coming from a meta zone, this region is used for checking if the time zone is a reference zone of the meta zone.
      Returns:
      the target region
    • getTimeType

      private TimeZoneFormat.TimeType getTimeType(TimeZoneNames.NameType nameType)
      Returns the time type for the given name type
      Parameters:
      nameType - the name type
      Returns:
      the time type (unknown/standard/daylight)
    • initGMTPattern

      private void initGMTPattern(String gmtPattern)
      Parses the localized GMT pattern string and initialize localized gmt pattern fields including #_gmtPatternTokens. This method must be also called at deserialization time.
      Parameters:
      gmtPattern - the localized GMT pattern string such as "GMT {0}"
      Throws:
      IllegalArgumentException - when the pattern string does not contain "{0}"
    • unquote

      private static String unquote(String s)
      Unquotes the message format style pattern.
      Parameters:
      s - the pattern
      Returns:
      the unquoted pattern string
    • initGMTOffsetPatterns

      private void initGMTOffsetPatterns(String[] gmtOffsetPatterns)
      Initialize localized GMT format offset hour/min/sec patterns. This method parses patterns into optimized run-time format. This method must be called at deserialization time.
      Parameters:
      gmtOffsetPatterns - patterns, String[4]
      Throws:
      IllegalArgumentException - when patterns are not valid
    • checkAbuttingHoursAndMinutes

      private void checkAbuttingHoursAndMinutes()
    • parseOffsetPattern

      private static Object[] parseOffsetPattern(String pattern, String letters)
      Parse the GMT offset pattern into runtime optimized format
      Parameters:
      pattern - the offset pattern string
      letters - the required pattern letters such as "Hm"
      Returns:
      An array of Object. Each array entry is either String (representing pattern literal) or GMTOffsetField (hour/min/sec field)
    • expandOffsetPattern

      private static String expandOffsetPattern(String offsetHM)
      Appends seconds field to the offset pattern with hour/minute
      Parameters:
      offsetHM - the offset pattern including hours and minutes fields
      Returns:
      the offset pattern including hours, minutes and seconds fields
    • truncateOffsetPattern

      private static String truncateOffsetPattern(String offsetHM)
      Truncates minutes field from the offset pattern with hour/minute
      Parameters:
      offsetHM - the offset pattern including hours and minutes fields
      Returns:
      the offset pattern including only hours field
    • appendOffsetDigits

      private void appendOffsetDigits(StringBuilder buf, int n, int minDigits)
      Appends localized digits to the buffer.

      Note: This code assumes that the input number is 0 - 59

      Parameters:
      buf - the target buffer
      n - the integer number
      minDigits - the minimum digits width
    • getTimeZoneForOffset

      private TimeZone getTimeZoneForOffset(int offset)
      Creates an instance of TimeZone for the given offset
      Parameters:
      offset - the offset
      Returns:
      A TimeZone with the given offset
    • parseOffsetLocalizedGMT

      private int parseOffsetLocalizedGMT(String text, ParsePosition pos, boolean isShort, Output<Boolean> hasDigitOffset)
      Returns offset from GMT(UTC) in milliseconds for the given localized GMT offset format string. When the given string cannot be parsed, this method sets the current position as the error index to ParsePosition pos and returns 0.
      Parameters:
      text - the text contains a localized GMT offset string at the position.
      pos - the position.
      isShort - true if this parser to try the short format first
      hasDigitOffset - receiving if the parsed zone string contains offset digits.
      Returns:
      the offset from GMT(UTC) in milliseconds for the given localized GMT offset format string.
    • parseOffsetLocalizedGMTPattern

      private int parseOffsetLocalizedGMTPattern(String text, int start, boolean isShort, int[] parsedLen)
      Parse localized GMT format generated by the pattern used by this formatter, except GMT Zero format.
      Parameters:
      text - the input text
      start - the start index
      isShort - true if the short localized GMT format is parsed.
      parsedLen - the parsed length, or 0 on failure.
      Returns:
      the parsed offset in milliseconds.
    • parseOffsetFields

      private int parseOffsetFields(String text, int start, boolean isShort, int[] parsedLen)
      Parses localized GMT offset fields into offset.
      Parameters:
      text - the input text
      start - the start index
      isShort - true if this is a short format - currently not used
      parsedLen - the parsed length, or 0 on failure.
      Returns:
      the parsed offset in milliseconds.
    • parseOffsetFieldsWithPattern

      private int parseOffsetFieldsWithPattern(String text, int start, Object[] patternItems, boolean forceSingleHourDigit, int[] fields)
      Parses localized GMT offset fields with the given pattern
      Parameters:
      text - the input text
      start - the start index
      patternItems - the pattern (already itemized)
      forceSingleHourDigit - true if hours field is parsed as a single digit
      fields - receives the parsed hours/minutes/seconds
      Returns:
      parsed length
    • parseOffsetDefaultLocalizedGMT

      private int parseOffsetDefaultLocalizedGMT(String text, int start, int[] parsedLen)
      Parses the input text using the default format patterns (e.g. "UTC{0}").
      Parameters:
      text - the input text
      start - the start index
      parsedLen - the parsed length, or 0 on failure
      Returns:
      the parsed offset in milliseconds.
    • parseDefaultOffsetFields

      private int parseDefaultOffsetFields(String text, int start, char separator, int[] parsedLen)
      Parses the input GMT offset fields with the default offset pattern.
      Parameters:
      text - the input text
      start - the start index
      separator - the separator character, e.g. ':'
      parsedLen - the parsed length, or 0 on failure.
      Returns:
      the parsed offset in milliseconds.
    • parseAbuttingOffsetFields

      private int parseAbuttingOffsetFields(String text, int start, int[] parsedLen)
      Parses abutting localized GMT offset fields (such as 0800) into offset.
      Parameters:
      text - the input text
      start - the start index
      parsedLen - the parsed length, or 0 on failure
      Returns:
      the parsed offset in milliseconds.
    • parseOffsetFieldWithLocalizedDigits

      private int parseOffsetFieldWithLocalizedDigits(String text, int start, int minDigits, int maxDigits, int minVal, int maxVal, int[] parsedLen)
      Reads an offset field value. This method will stop parsing when 1) number of digits reaches maxDigits 2) just before already parsed number exceeds maxVal
      Parameters:
      text - the text
      start - the start offset
      minDigits - the minimum number of required digits
      maxDigits - the maximum number of digits
      minVal - the minimum value
      maxVal - the maximum value
      parsedLen - the actual parsed length is set to parsedLen[0], must not be null.
      Returns:
      the integer value parsed
    • parseSingleLocalizedDigit

      private int parseSingleLocalizedDigit(String text, int start, int[] len)
      Reads a single decimal digit, either localized digits used by this object or any Unicode numeric character.
      Parameters:
      text - the text
      start - the start index
      len - the actual length read from the text the start index is not a decimal number.
      Returns:
      the integer value of the parsed digit, or -1 on failure.
    • toCodePoints

      private static String[] toCodePoints(String str)
      Break input String into String[]. Each array element represents a code point. This method is used for parsing localized digit characters and support characters in Unicode supplemental planes.
      Parameters:
      str - the string
      Returns:
      the array of code points in String[]
    • parseOffsetISO8601

      private static int parseOffsetISO8601(String text, ParsePosition pos, boolean extendedOnly, Output<Boolean> hasDigitOffset)
      Returns offset from GMT(UTC) in milliseconds for the given ISO 8601 time zone string (basic format, extended format, or UTC indicator). When the given string is not an ISO 8601 time zone string, this method sets the current position as the error index to ParsePosition pos and returns 0.
      Parameters:
      text - the text contains ISO 8601 style time zone string (e.g. "-08", "-08:00", "Z") at the position.
      pos - the position.
      extendedOnly - true if parsing the text as ISO 8601 extended offset format (e.g. "-08:00"), or false to evaluate the text as basic format.
      hasDigitOffset - receiving if the parsed zone string contains offset digits.
      Returns:
      the offset from GMT(UTC) in milliseconds for the given ISO 8601 style time zone string.
    • parseAbuttingAsciiOffsetFields

      private static int parseAbuttingAsciiOffsetFields(String text, ParsePosition pos, TimeZoneFormat.OffsetFields minFields, TimeZoneFormat.OffsetFields maxFields, boolean fixedHourWidth)
      Parses offset represented by contiguous ASCII digits

      Note: This method expects the input position is already at the start of ASCII digits and does not parse sign (+/-).

      Parameters:
      text - The text contains a sequence of ASCII digits
      pos - The parse position
      minFields - The minimum Fields to be parsed
      maxFields - The maximum Fields to be parsed
      fixedHourWidth - true if hours field must be width of 2
      Returns:
      Parsed offset, 0 or positive number.
    • parseAsciiOffsetFields

      private static int parseAsciiOffsetFields(String text, ParsePosition pos, char sep, TimeZoneFormat.OffsetFields minFields, TimeZoneFormat.OffsetFields maxFields)
      Parses offset represented by ASCII digits and separators.

      Note: This method expects the input position is already at the start of ASCII digits and does not parse sign (+/-).

      Parameters:
      text - The text
      pos - The parse position
      sep - The separator character
      minFields - The minimum Fields to be parsed
      maxFields - The maximum Fields to be parsed
      Returns:
      Parsed offset, 0 or positive number.
    • parseZoneID

      private static String parseZoneID(String text, ParsePosition pos)
      Parse a zone ID.
      Parameters:
      text - the text contains a time zone ID string at the position.
      pos - the position.
      Returns:
      The zone ID parsed.
    • parseShortZoneID

      private static String parseShortZoneID(String text, ParsePosition pos)
      Parse a short zone ID.
      Parameters:
      text - the text contains a time zone ID string at the position.
      pos - the position.
      Returns:
      The zone ID for the parsed short zone ID.
    • parseExemplarLocation

      private String parseExemplarLocation(String text, ParsePosition pos)
      Parse an exemplar location string.
      Parameters:
      text - the text contains an exemplar location string at the position.
      pos - the position.
      Returns:
      The zone ID for the parsed exemplar location.
    • writeObject

      private void writeObject(ObjectOutputStream oos) throws IOException
      Parameters:
      oos - the object output stream
      Throws:
      IOException
    • readObject

      private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException
      Parameters:
      ois - the object input stream
      Throws:
      ClassNotFoundException
      IOException
    • isFrozen

      public boolean isFrozen()
      Determines whether the object has been frozen or not.
      Specified by:
      isFrozen in interface Freezable<TimeZoneFormat>
    • freeze

      public TimeZoneFormat freeze()
      Freezes the object.
      Specified by:
      freeze in interface Freezable<TimeZoneFormat>
      Returns:
      the object itself.
    • cloneAsThawed

      public TimeZoneFormat cloneAsThawed()
      Provides for the clone operation. Any clone is initially unfrozen.
      Specified by:
      cloneAsThawed in interface Freezable<TimeZoneFormat>