Class MailDateFormat.AbstractDateParser

  • Direct Known Subclasses:
    MailDateFormat.Rfc2822StrictParser
    Enclosing class:
    MailDateFormat

    private abstract static class MailDateFormat.AbstractDateParser
    extends java.lang.Object
    This class provides the building blocks for date parsing.

    It has the following invariants:

    • no exceptions are thrown, except for java.text.ParseException from parse* methods
    • when parse* throws ParseException OR get* returns INVALID_CHAR OR skip* returns false OR peek* is invoked, then pos.getIndex() on method exit is the same as it was on method entry
    • Field Detail

      • text

        final java.lang.String text
      • pos

        final java.text.ParsePosition pos
    • Constructor Detail

      • AbstractDateParser

        AbstractDateParser​(java.lang.String text,
                           java.text.ParsePosition pos)
    • Method Detail

      • parse

        final java.util.Date parse()
      • tryParse

        abstract java.util.Date tryParse()
                                  throws java.text.ParseException
        Throws:
        java.text.ParseException
      • parseDayName

        final int parseDayName()
                        throws java.text.ParseException
        Returns:
        the java.util.Calendar constant for the parsed day name
        Throws:
        java.text.ParseException
      • parseMonthName

        final int parseMonthName​(boolean caseSensitive)
                          throws java.text.ParseException
        Returns:
        the java.util.Calendar constant for the parsed month name
        Throws:
        java.text.ParseException
      • parseZoneOffset

        final int parseZoneOffset()
                           throws java.text.ParseException
        Returns:
        the number of minutes to be added to the time in the local time zone, in order to obtain the equivalent time in the UTC time zone. Returns 0 if the date-time contains no information about the local time zone.
        Throws:
        java.text.ParseException
      • isValidZoneOffset

        boolean isValidZoneOffset​(int offset)
      • parseAsciiDigits

        final int parseAsciiDigits​(int count)
                            throws java.text.ParseException
        Throws:
        java.text.ParseException
      • parseAsciiDigits

        final int parseAsciiDigits​(int min,
                                   int max)
                            throws java.text.ParseException
        Throws:
        java.text.ParseException
      • parseAsciiDigits

        final int parseAsciiDigits​(int min,
                                   int max,
                                   boolean isEOF)
                            throws java.text.ParseException
        Throws:
        java.text.ParseException
      • parseFoldingWhiteSpace

        final void parseFoldingWhiteSpace()
                                   throws java.text.ParseException
        Throws:
        java.text.ParseException
      • parseChar

        final void parseChar​(char ch)
                      throws java.text.ParseException
        Throws:
        java.text.ParseException
      • getAsciiDigit

        final int getAsciiDigit()
      • getChar

        final int getChar()
      • skipFoldingWhiteSpace

        boolean skipFoldingWhiteSpace()
      • skipWhiteSpace

        final boolean skipWhiteSpace()
      • skipNewline

        final boolean skipNewline()
      • skipAlternativeTriple

        final boolean skipAlternativeTriple​(char firstStandard,
                                            char firstAlternative,
                                            char secondStandard,
                                            char secondAlternative,
                                            char thirdStandard,
                                            char thirdAlternative)
      • skipAlternativePair

        final boolean skipAlternativePair​(char firstStandard,
                                          char firstAlternative,
                                          char secondStandard,
                                          char secondAlternative)
      • skipAlternative

        final boolean skipAlternative​(char standard,
                                      char alternative)
      • skipPair

        final boolean skipPair​(char first,
                               char second)
      • skipChar

        final boolean skipChar​(char ch)
      • peekAsciiDigit

        final boolean peekAsciiDigit()
      • peekFoldingWhiteSpace

        boolean peekFoldingWhiteSpace()
      • peekChar

        final boolean peekChar​(char ch)