java.lang.Object
net.i2p.router.news.RFC3339Date
RFC 3339 date parsing utility for Atom feed compatibility.
Provides parsing and formatting of dates according to RFC 3339 (ISO 8601) and RFC 4287 Atom specifications. Supports multiple date formats including timezone handling and millisecond precision.
Adapted from RFC822Date with enhanced support for modern date formats and timezone specifications. Handles both numeric and named timezone offsets with proper validation.
Thread-safe implementation with ThreadLocal formatters for concurrent access. Includes comprehensive format support for various date representations encountered in news feeds.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ThreadLocal<DateFormat[]> Formatters tried when parsing a date.private static final ThreadLocal<DateFormat> Formatter writing an RFC 3339 date.private static final StringFirst timezone format accepted when parsing.private static final StringSecond timezone format accepted when parsing.Constructor Summary
ConstructorsConstructorDescriptionConstructor for subclasses; the parser and formatter in this base class are static.Method Summary
All MethodsModifier and TypeMethodDescriptionstatic longParse the date.static Stringto3339Date(long t) Format is "yyyy-MM-ddTHH:mm:ssZ".
Field Details
TZF1
First timezone format accepted when parsing.TZF2
Second timezone format accepted when parsing.OUTPUT_FORMAT
Formatter writing an RFC 3339 date.DATE_FORMATS
Formatters tried when parsing a date.
Constructor Details
RFC3339Date
public RFC3339Date()Constructor for subclasses; the parser and formatter in this base class are static.
Method Details
parse3339Date
Parse the date.- Parameters:
s- non-null- Returns:
- -1 on failure
to3339Date
Format is "yyyy-MM-ddTHH:mm:ssZ".- Parameters:
t- milliseconds since the epoch to render, always formatted in GMT- Returns:
- the instant rendered as yyyy-MM-ddTHH:mm:ssZ with a literal Z