Class TimeZoneFormat

    • Field Detail

      • _gmtPattern

        private java.lang.String _gmtPattern
      • _gmtOffsetPatterns

        private java.lang.String[] _gmtOffsetPatterns
      • _gmtOffsetDigits

        private java.lang.String[] _gmtOffsetDigits
      • _gmtZeroFormat

        private java.lang.String _gmtZeroFormat
      • _parseAllStyles

        private boolean _parseAllStyles
      • _parseTZDBNames

        private boolean _parseTZDBNames
      • _gmtPatternPrefix

        private transient java.lang.String _gmtPatternPrefix
      • _gmtPatternSuffix

        private transient java.lang.String _gmtPatternSuffix
      • _gmtOffsetPatternItems

        private transient java.lang.Object[][] _gmtOffsetPatternItems
      • _abuttingOffsetHoursAndMinutes

        private transient boolean _abuttingOffsetHoursAndMinutes
      • _region

        private transient java.lang.String _region
      • _frozen

        private transient volatile boolean _frozen
      • _tzdbNames

        private transient volatile TimeZoneNames _tzdbNames
      • ALT_GMT_STRINGS

        private static final java.lang.String[] ALT_GMT_STRINGS
      • DEFAULT_GMT_PATTERN

        private static final java.lang.String DEFAULT_GMT_PATTERN
        See Also:
        Constant Field Values
      • DEFAULT_GMT_ZERO

        private static final java.lang.String DEFAULT_GMT_ZERO
        See Also:
        Constant Field Values
      • DEFAULT_GMT_DIGITS

        private static final java.lang.String[] DEFAULT_GMT_DIGITS
      • DEFAULT_GMT_OFFSET_SEP

        private static final char DEFAULT_GMT_OFFSET_SEP
        See Also:
        Constant Field Values
      • UNKNOWN_SHORT_ZONE_ID

        private static final java.lang.String UNKNOWN_SHORT_ZONE_ID
        See Also:
        Constant Field Values
      • UNKNOWN_LOCATION

        private static final java.lang.String UNKNOWN_LOCATION
        See Also:
        Constant Field Values
      • ZONE_ID_TRIE

        private static volatile TextTrieMap<java.lang.String> ZONE_ID_TRIE
      • SHORT_ZONE_ID_TRIE

        private static volatile TextTrieMap<java.lang.String> SHORT_ZONE_ID_TRIE
      • serialPersistentFields

        private static final java.io.ObjectStreamField[] serialPersistentFields
    • Constructor Detail

      • TimeZoneFormat

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

      • 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​(java.util.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.
      • 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.
      • 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:
        java.lang.UnsupportedOperationException - when this object is frozen.
        See Also:
        getTimeZoneNames()
      • getGMTPattern

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

        public TimeZoneFormat setGMTPattern​(java.lang.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:
        java.lang.IllegalArgumentException - when the pattern string does not contain "{0}"
        java.lang.UnsupportedOperationException - when this object is frozen.
        See Also:
        getGMTPattern()
      • setGMTOffsetPattern

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

        public java.lang.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(String)
      • setGMTOffsetDigits

        public TimeZoneFormat setGMTOffsetDigits​(java.lang.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:
        java.lang.IllegalArgumentException - when the string did not contain ten characters.
        java.lang.UnsupportedOperationException - when this object is frozen.
        See Also:
        getGMTOffsetDigits()
      • getGMTZeroFormat

        public java.lang.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(String)
      • setGMTZeroFormat

        public TimeZoneFormat setGMTZeroFormat​(java.lang.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:
        java.lang.UnsupportedOperationException - when this object is frozen.
        See Also:
        getGMTZeroFormat()
      • formatOffsetISO8601Basic

        public final java.lang.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:
        java.lang.IllegalArgumentException - if the specified offset is out of supported range (-24 hours < offset < +24 hours).
        See Also:
        formatOffsetISO8601Extended(int, boolean, boolean, boolean), parseOffsetISO8601(String, ParsePosition)
      • formatOffsetISO8601Extended

        public final java.lang.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:
        java.lang.IllegalArgumentException - if the specified offset is out of supported range (-24 hours < offset < +24 hours).
        See Also:
        formatOffsetISO8601Basic(int, boolean, boolean, boolean), parseOffsetISO8601(String, ParsePosition)
      • formatOffsetLocalizedGMT

        public java.lang.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:
        java.lang.IllegalArgumentException - if the specified offset is out of supported range (-24 hours < offset < +24 hours).
        See Also:
        parseOffsetLocalizedGMT(String, ParsePosition)
      • formatOffsetShortLocalizedGMT

        public java.lang.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:
        java.lang.IllegalArgumentException - if the specified offset is out of supported range (-24 hours < offset < +24 hours).
        See Also:
        parseOffsetLocalizedGMT(String, ParsePosition)
      • format

        public final java.lang.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:
        TimeZoneFormat.Style, format(Style, TimeZone, long, Output)
      • format

        public java.lang.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:
        TimeZoneFormat.Style, format(Style, TimeZone, long)
      • parseOffsetISO8601

        public final int parseOffsetISO8601​(java.lang.String text,
                                            java.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:
        formatOffsetISO8601Basic(int, boolean, boolean, boolean), formatOffsetISO8601Extended(int, boolean, boolean, boolean)
      • parseOffsetLocalizedGMT

        public int parseOffsetLocalizedGMT​(java.lang.String text,
                                           java.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:
        formatOffsetLocalizedGMT(int)
      • parseOffsetShortLocalizedGMT

        public int parseOffsetShortLocalizedGMT​(java.lang.String text,
                                                java.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:
        formatOffsetShortLocalizedGMT(int)
      • parse

        public TimeZone parse​(TimeZoneFormat.Style style,
                              java.lang.String text,
                              java.text.ParsePosition pos,
                              java.util.EnumSet<TimeZoneFormat.ParseOption> options,
                              Output<TimeZoneFormat.TimeType> timeType)
        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:
        TimeZoneFormat.Style, format(Style, TimeZone, long, Output)
      • parse

        public final TimeZone parse​(java.lang.String text)
                             throws java.text.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:
        java.text.ParseException - when the input could not be parsed as a time zone string.
        See Also:
        parse(String, ParsePosition)
      • format

        public java.lang.StringBuffer format​(java.lang.Object obj,
                                             java.lang.StringBuffer toAppendTo,
                                             java.text.FieldPosition pos)
        Specified by:
        format in class java.text.Format
      • formatToCharacterIterator

        public java.text.AttributedCharacterIterator formatToCharacterIterator​(java.lang.Object obj)
        Overrides:
        formatToCharacterIterator in class java.text.Format
      • parseObject

        public java.lang.Object parseObject​(java.lang.String source,
                                            java.text.ParsePosition pos)
        Specified by:
        parseObject in class java.text.Format
      • formatOffsetLocalizedGMT

        private java.lang.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 java.lang.String formatOffsetISO8601​(int offset,
                                                     boolean isBasic,
                                                     boolean useUtcIndicator,
                                                     boolean isShort,
                                                     boolean ignoreSeconds)
      • formatSpecific

        private java.lang.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 java.lang.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 java.lang.String getTimeZoneID​(java.lang.String tzID,
                                               java.lang.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:
        java.lang.IllegalArgumentException - when both tzID and mzID are null
      • getTargetRegion

        private java.lang.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​(java.lang.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:
        java.lang.IllegalArgumentException - when the pattern string does not contain "{0}"
      • unquote

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

        private void initGMTOffsetPatterns​(java.lang.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:
        java.lang.IllegalArgumentException - when patterns are not valid
      • checkAbuttingHoursAndMinutes

        private void checkAbuttingHoursAndMinutes()
      • parseOffsetPattern

        private static java.lang.Object[] parseOffsetPattern​(java.lang.String pattern,
                                                             java.lang.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 java.lang.String expandOffsetPattern​(java.lang.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 java.lang.String truncateOffsetPattern​(java.lang.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​(java.lang.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​(java.lang.String text,
                                            java.text.ParsePosition pos,
                                            boolean isShort,
                                            Output<java.lang.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​(java.lang.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​(java.lang.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​(java.lang.String text,
                                                 int start,
                                                 java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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 java.lang.String[] toCodePoints​(java.lang.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​(java.lang.String text,
                                              java.text.ParsePosition pos,
                                              boolean extendedOnly,
                                              Output<java.lang.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​(java.lang.String text,
                                                          java.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​(java.lang.String text,
                                                  java.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 java.lang.String parseZoneID​(java.lang.String text,
                                                    java.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 java.lang.String parseShortZoneID​(java.lang.String text,
                                                         java.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 java.lang.String parseExemplarLocation​(java.lang.String text,
                                                       java.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​(java.io.ObjectOutputStream oos)
                          throws java.io.IOException
        Parameters:
        oos - the object output stream
        Throws:
        java.io.IOException
      • readObject

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

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