Top Description Fields Constructors Methods
org.glassfish.grizzly.http.util

public Class FastDateFormat

extends DateFormat
Class Inheritance
Imports
java.text.DateFormat, .FieldPosition, .ParsePosition, java.util.Date

Fast date formatter that caches recently formatted date information and uses it to avoid too-frequent calls to the underlying formatter.

Note

breaks fieldPosition param of format(Date, StringBuffer, FieldPosition). If you care about the field position, call the underlying DateFormat directly.

Authors
Stan Bailes, Alex Chaffee

Field Summary

Modifier and TypeField and Description
pack-priv final DateFormat
pack-priv final transient FieldPosition
pack-priv long
pack-priv final StringBuffer
private static final long
Inherited from java.text.DateFormat:
AM_PM_FIELDcalendarDATE_FIELDDAY_OF_WEEK_FIELDDAY_OF_WEEK_IN_MONTH_FIELDDAY_OF_YEAR_FIELDDEFAULTERA_FIELDFULLHOUR0_FIELDHOUR1_FIELDHOUR_OF_DAY0_FIELDHOUR_OF_DAY1_FIELDLONGMEDIUMMILLISECOND_FIELDMINUTE_FIELDMONTH_FIELDnumberFormatSECOND_FIELDSHORTTIMEZONE_FIELDWEEK_OF_MONTH_FIELDWEEK_OF_YEAR_FIELDYEAR_FIELD

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public StringBuffer
format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition)

Implements abstract java.text.DateFormat.format.

Note

breaks functionality of fieldPosition param.

public StringBuilder
format(Date date, StringBuilder toAppendTo, FieldPosition fieldPosition)

Note

breaks functionality of fieldPosition param.

public Date
parse(String text, ParsePosition pos)

Implements abstract java.text.DateFormat.parse.

Parse a date/time string according to the given parse position.

Inherited from java.text.DateFormat:
cloneequalsformatformatgetAvailableLocalesgetCalendargetDateInstancegetDateInstancegetDateInstancegetDateTimeInstancegetDateTimeInstancegetDateTimeInstancegetInstancegetNumberFormatgetTimeInstancegetTimeInstancegetTimeInstancegetTimeZonehashCodeisLenientparseparseObjectsetCalendarsetLenientsetNumberFormatsetTimeZone

Field Detail

dfback to summary
pack-priv final DateFormat df
fpback to summary
pack-priv final transient FieldPosition fp
lastSecback to summary
pack-priv long lastSec
sbback to summary
pack-priv final StringBuffer sb
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.text.DateFormat.serialVersionUID.

Constructor Detail

FastDateFormatback to summary
public FastDateFormat(DateFormat df)

Method Detail

formatback to summary
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition)

Implements abstract java.text.DateFormat.format.

Note

breaks functionality of fieldPosition param. Also: there's a bug in SimpleDateFormat with "S" and "SS", use "SSS" instead if you want a msec field.

Annotations
@Override
formatback to summary
public StringBuilder format(Date date, StringBuilder toAppendTo, FieldPosition fieldPosition)

Note

breaks functionality of fieldPosition param. Also: there's a bug in SimpleDateFormat with "S" and "SS", use "SSS" instead if you want a msec field.

parseback to summary
public Date parse(String text, ParsePosition pos)

Implements abstract java.text.DateFormat.parse.

Doc from java.text.DateFormat.parse.

Parse a date/time string according to the given parse position. For example, if this has the pattern "M/d/yy h:m a, z", then a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date that is equivalent to Date(837039900000L).

By default, parsing is lenient: If the input is not in the form used by this object's format method but can still be parsed as a date, then the parse succeeds. Clients may insist on strict adherence to the format by calling setLenient(false).

This parsing operation uses the calendar to produce a Date. As a result, the calendar's date-time fields and the TimeZone value may have been overwritten, depending on subclass implementations. Any TimeZone value that has previously been set by a call to setTimeZone may need to be restored for further operations.

Annotations
@Override