/** * Parses the given date in the format specified by * RFC 2822. * <ul> * <li>With strict parsing, obs-* tokens are unsupported. Lenient parsing * supports obs-year and obs-zone, with the exception of the 1-character * military time zones. * <li>The optional CFWS token at the end is not parsed. * <li>RFC 2822 specifies that a zone of "-0000" indicates that the * date-time contains no information about the local time zone. This class * uses the UTC time zone in this case. * </ul> * * @param text the formatted date to be parsed * @param pos the current parse position * @return Date the parsed date. In case of error, returns null. * @since JavaMail 1.2 */ @Override public Date parse(String text, ParsePosition pos) { if (text == null || pos == null) { throw new NullPointerException(); } else if (0 > pos.getIndex() || pos.getIndex() >= text.length()) { return null; } return isLenient() ? new Rfc2822LenientParser(text, pos).parse() : new Rfc2822StrictParser(text, pos).parse(); }
if (peekChar('+') || peekChar('-')) { return parseZoneOffset(); } else if (skipAlternativePair('U', 'u', 'T', 't')) { return 0; } else if (skipAlternativeTriple('G', 'g', 'M', 'm', 'T', 't')) { return 0; } else { int hoursOffset; if (skipAlternative('E', 'e')) { hoursOffset = 4; } else if (skipAlternative('C', 'c')) { hoursOffset = 5; } else if (skipAlternative('M', 'm')) { hoursOffset = 6; } else if (skipAlternative('P', 'p')) { hoursOffset = 7; } else { pos.getIndex()); if (skipAlternativePair('S', 's', 'T', 't')) { hoursOffset += 1; } else if (skipAlternativePair('D', 'd', 'T', 't')) { } else { pos.setIndex(pos.getIndex() - 1);
@Override int parseOptionalBegin() { while (pos.getIndex() < text.length() && !peekAsciiDigit()) { pos.setIndex(pos.getIndex() + 1); } return UNKNOWN_DAY_NAME; }
if (peekChar('+') || peekChar('-')) { return parseZoneOffset(); } else if (skipAlternativePair('U', 'u', 'T', 't')) { return 0; } else if (skipAlternativeTriple('G', 'g', 'M', 'm', 'T', 't')) { return 0; } else { int hoursOffset; if (skipAlternative('E', 'e')) { hoursOffset = 4; } else if (skipAlternative('C', 'c')) { hoursOffset = 5; } else if (skipAlternative('M', 'm')) { hoursOffset = 6; } else if (skipAlternative('P', 'p')) { hoursOffset = 7; } else { pos.getIndex()); if (skipAlternativePair('S', 's', 'T', 't')) { hoursOffset += 1; } else if (skipAlternativePair('D', 'd', 'T', 't')) { } else { pos.setIndex(pos.getIndex() - 1);
if (peekChar('+') || peekChar('-')) { return parseZoneOffset(); } else if (skipAlternativePair('U', 'u', 'T', 't')) { return 0; } else if (skipAlternativeTriple('G', 'g', 'M', 'm', 'T', 't')) { return 0; } else { int hoursOffset; if (skipAlternative('E', 'e')) { hoursOffset = 4; } else if (skipAlternative('C', 'c')) { hoursOffset = 5; } else if (skipAlternative('M', 'm')) { hoursOffset = 6; } else if (skipAlternative('P', 'p')) { hoursOffset = 7; } else { pos.getIndex()); if (skipAlternativePair('S', 's', 'T', 't')) { hoursOffset += 1; } else if (skipAlternativePair('D', 'd', 'T', 't')) { } else { pos.setIndex(pos.getIndex() - 1);
if (peekChar('+') || peekChar('-')) { return parseZoneOffset(); } else if (skipAlternativePair('U', 'u', 'T', 't')) { return 0; } else if (skipAlternativeTriple('G', 'g', 'M', 'm', 'T', 't')) { return 0; } else { int hoursOffset; if (skipAlternative('E', 'e')) { hoursOffset = 4; } else if (skipAlternative('C', 'c')) { hoursOffset = 5; } else if (skipAlternative('M', 'm')) { hoursOffset = 6; } else if (skipAlternative('P', 'p')) { hoursOffset = 7; } else { pos.getIndex()); if (skipAlternativePair('S', 's', 'T', 't')) { hoursOffset += 1; } else if (skipAlternativePair('D', 'd', 'T', 't')) { } else { pos.setIndex(pos.getIndex() - 1);
if (peekChar('+') || peekChar('-')) { return parseZoneOffset(); } else if (skipAlternativePair('U', 'u', 'T', 't')) { return 0; } else if (skipAlternativeTriple('G', 'g', 'M', 'm', 'T', 't')) { return 0; } else { int hoursOffset; if (skipAlternative('E', 'e')) { hoursOffset = 4; } else if (skipAlternative('C', 'c')) { hoursOffset = 5; } else if (skipAlternative('M', 'm')) { hoursOffset = 6; } else if (skipAlternative('P', 'p')) { hoursOffset = 7; } else { pos.getIndex()); if (skipAlternativePair('S', 's', 'T', 't')) { hoursOffset += 1; } else if (skipAlternativePair('D', 'd', 'T', 't')) { } else { pos.setIndex(pos.getIndex() - 1);
if (peekChar('+') || peekChar('-')) { return parseZoneOffset(); } else if (skipAlternativePair('U', 'u', 'T', 't')) { return 0; } else if (skipAlternativeTriple('G', 'g', 'M', 'm', 'T', 't')) { return 0; } else { int hoursOffset; if (skipAlternative('E', 'e')) { hoursOffset = 4; } else if (skipAlternative('C', 'c')) { hoursOffset = 5; } else if (skipAlternative('M', 'm')) { hoursOffset = 6; } else if (skipAlternative('P', 'p')) { hoursOffset = 7; } else { pos.getIndex()); if (skipAlternativePair('S', 's', 'T', 't')) { hoursOffset += 1; } else if (skipAlternativePair('D', 'd', 'T', 't')) { } else { pos.setIndex(pos.getIndex() - 1);
if (peekChar('+') || peekChar('-')) { return parseZoneOffset(); } else if (skipAlternativePair('U', 'u', 'T', 't')) { return 0; } else if (skipAlternativeTriple('G', 'g', 'M', 'm', 'T', 't')) { return 0; } else { int hoursOffset; if (skipAlternative('E', 'e')) { hoursOffset = 4; } else if (skipAlternative('C', 'c')) { hoursOffset = 5; } else if (skipAlternative('M', 'm')) { hoursOffset = 6; } else if (skipAlternative('P', 'p')) { hoursOffset = 7; } else { pos.getIndex()); if (skipAlternativePair('S', 's', 'T', 't')) { hoursOffset += 1; } else if (skipAlternativePair('D', 'd', 'T', 't')) { } else { pos.setIndex(pos.getIndex() - 1);
/** * Parses the given date in the format specified by * RFC 2822. * <ul> * <li>With strict parsing, obs-* tokens are unsupported. Lenient parsing * supports obs-year and obs-zone, with the exception of the 1-character * military time zones. * <li>The optional CFWS token at the end is not parsed. * <li>RFC 2822 specifies that a zone of "-0000" indicates that the * date-time contains no information about the local time zone. This class * uses the UTC time zone in this case. * </ul> * * @param text the formatted date to be parsed * @param pos the current parse position * @return Date the parsed date. In case of error, returns null. * @since JavaMail 1.2 */ @Override public Date parse(String text, ParsePosition pos) { if (text == null || pos == null) { throw new NullPointerException(); } else if (0 > pos.getIndex() || pos.getIndex() >= text.length()) { return null; } return isLenient() ? new Rfc2822LenientParser(text, pos).parse() : new Rfc2822StrictParser(text, pos).parse(); }
/** * Parses the given date in the format specified by * RFC 2822. * <ul> * <li>With strict parsing, obs-* tokens are unsupported. Lenient parsing * supports obs-year and obs-zone, with the exception of the 1-character * military time zones. * <li>The optional CFWS token at the end is not parsed. * <li>RFC 2822 specifies that a zone of "-0000" indicates that the * date-time contains no information about the local time zone. This class * uses the UTC time zone in this case. * </ul> * * @param text the formatted date to be parsed * @param pos the current parse position * @return Date the parsed date. In case of error, returns null. * @since JavaMail 1.2 */ @Override public Date parse(String text, ParsePosition pos) { if (text == null || pos == null) { throw new NullPointerException(); } else if (0 > pos.getIndex() || pos.getIndex() >= text.length()) { return null; } return isLenient() ? new Rfc2822LenientParser(text, pos).parse() : new Rfc2822StrictParser(text, pos).parse(); }
/** * Parses the given date in the format specified by * RFC 2822. * <ul> * <li>With strict parsing, obs-* tokens are unsupported. Lenient parsing * supports obs-year and obs-zone, with the exception of the 1-character * military time zones. * <li>The optional CFWS token at the end is not parsed. * <li>RFC 2822 specifies that a zone of "-0000" indicates that the * date-time contains no information about the local time zone. This class * uses the UTC time zone in this case. * </ul> * * @param text the formatted date to be parsed * @param pos the current parse position * @return Date the parsed date. In case of error, returns null. * @since JavaMail 1.2 */ @Override public Date parse(String text, ParsePosition pos) { if (text == null || pos == null) { throw new NullPointerException(); } else if (0 > pos.getIndex() || pos.getIndex() >= text.length()) { return null; } return isLenient() ? new Rfc2822LenientParser(text, pos).parse() : new Rfc2822StrictParser(text, pos).parse(); }
/** * Parses the given date in the format specified by * RFC 2822. * <ul> * <li>With strict parsing, obs-* tokens are unsupported. Lenient parsing * supports obs-year and obs-zone, with the exception of the 1-character * military time zones. * <li>The optional CFWS token at the end is not parsed. * <li>RFC 2822 specifies that a zone of "-0000" indicates that the * date-time contains no information about the local time zone. This class * uses the UTC time zone in this case. * </ul> * * @param text the formatted date to be parsed * @param pos the current parse position * @return Date the parsed date. In case of error, returns null. * @since JavaMail 1.2 */ @Override public Date parse(String text, ParsePosition pos) { if (text == null || pos == null) { throw new NullPointerException(); } else if (0 > pos.getIndex() || pos.getIndex() >= text.length()) { return null; } return isLenient() ? new Rfc2822LenientParser(text, pos).parse() : new Rfc2822StrictParser(text, pos).parse(); }
/** * Parses the given date in the format specified by * RFC 2822. * <ul> * <li>With strict parsing, obs-* tokens are unsupported. Lenient parsing * supports obs-year and obs-zone, with the exception of the 1-character * military time zones. * <li>The optional CFWS token at the end is not parsed. * <li>RFC 2822 specifies that a zone of "-0000" indicates that the * date-time contains no information about the local time zone. This class * uses the UTC time zone in this case. * </ul> * * @param text the formatted date to be parsed * @param pos the current parse position * @return Date the parsed date. In case of error, returns null. * @since JavaMail 1.2 */ @Override public Date parse(String text, ParsePosition pos) { if (text == null || pos == null) { throw new NullPointerException(); } else if (0 > pos.getIndex() || pos.getIndex() >= text.length()) { return null; } return isLenient() ? new Rfc2822LenientParser(text, pos).parse() : new Rfc2822StrictParser(text, pos).parse(); }
/** * Parses the given date in the format specified by * RFC 2822. * <ul> * <li>With strict parsing, obs-* tokens are unsupported. Lenient parsing * supports obs-year and obs-zone, with the exception of the 1-character * military time zones. * <li>The optional CFWS token at the end is not parsed. * <li>RFC 2822 specifies that a zone of "-0000" indicates that the * date-time contains no information about the local time zone. This class * uses the UTC time zone in this case. * </ul> * * @param text the formatted date to be parsed * @param pos the current parse position * @return Date the parsed date. In case of error, returns null. * @since JavaMail 1.2 */ @Override public Date parse(String text, ParsePosition pos) { if (text == null || pos == null) { throw new NullPointerException(); } else if (0 > pos.getIndex() || pos.getIndex() >= text.length()) { return null; } return isLenient() ? new Rfc2822LenientParser(text, pos).parse() : new Rfc2822StrictParser(text, pos).parse(); }
@Override boolean skipFoldingWhiteSpace() { boolean result = peekFoldingWhiteSpace(); skipLoop: while (pos.getIndex() < text.length()) { switch (text.charAt(pos.getIndex())) { case ' ': case '\t': case '\r': case '\n': pos.setIndex(pos.getIndex() + 1); break; default: break skipLoop; } } return result; }
@Override boolean skipFoldingWhiteSpace() { boolean result = peekFoldingWhiteSpace(); skipLoop: while (pos.getIndex() < text.length()) { switch (text.charAt(pos.getIndex())) { case ' ': case '\t': case '\r': case '\n': pos.setIndex(pos.getIndex() + 1); break; default: break skipLoop; } } return result; }
@Override boolean skipFoldingWhiteSpace() { boolean result = peekFoldingWhiteSpace(); skipLoop: while (pos.getIndex() < text.length()) { switch (text.charAt(pos.getIndex())) { case ' ': case '\t': case '\r': case '\n': pos.setIndex(pos.getIndex() + 1); break; default: break skipLoop; } } return result; }
@Override boolean skipFoldingWhiteSpace() { boolean result = peekFoldingWhiteSpace(); skipLoop: while (pos.getIndex() < text.length()) { switch (text.charAt(pos.getIndex())) { case ' ': case '\t': case '\r': case '\n': pos.setIndex(pos.getIndex() + 1); break; default: break skipLoop; } } return result; }
@Override boolean skipFoldingWhiteSpace() { boolean result = peekFoldingWhiteSpace(); skipLoop: while (pos.getIndex() < text.length()) { switch (text.charAt(pos.getIndex())) { case ' ': case '\t': case '\r': case '\n': pos.setIndex(pos.getIndex() + 1); break; default: break skipLoop; } } return result; }