|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mortbay.util.DateCache
public class DateCache
Date Format Cache. Computes String representations of Dates and caches the results so that subsequent requests within the same minute will be fast. Only format strings that contain either "ss" or "ss.SSS" are handled. The timezone of the date may be included as an ID with the "zzz" format string or as an offset with the "ZZZ" format string. If consecutive calls are frequently very different, then this may be a little slower than a normal DateFormat.
Field Summary | |
---|---|
private static long |
__hitWindow
|
private static long |
__MaxMisses
|
private DateFormatSymbols |
_dfs
|
private String |
_formatString
|
private long |
_lastMinutes
|
private String |
_lastResult
|
private long |
_lastSeconds
|
private Locale |
_locale
|
private boolean |
_millis
|
private SimpleDateFormat |
_minFormat
|
private String |
_minFormatString
|
private long |
_misses
|
private String |
_secFormatString
|
private String |
_secFormatString0
|
private String |
_secFormatString1
|
private SimpleDateFormat |
_tzFormat
|
private String |
_tzFormatString
|
Constructor Summary | |
---|---|
DateCache()
Constructor. |
|
DateCache(String format)
Constructor. |
|
DateCache(String format,
DateFormatSymbols s)
|
|
DateCache(String format,
Locale l)
|
Method Summary | |
---|---|
String |
format(Date inDate)
Format a date according to our stored formatter. |
String |
format(long inDate)
Format a date according to our stored formatter. |
void |
format(long inDate,
StringBuffer buffer)
Format to string buffer. |
SimpleDateFormat |
getFormat()
Get the format. |
String |
getFormatString()
|
TimeZone |
getTimeZone()
|
private void |
setMinFormatString()
|
void |
setTimeZone(TimeZone tz)
Set the timezone. |
void |
setTimeZoneID(String timeZoneId)
Set the timezone. |
private void |
setTzFormatString(TimeZone tz)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static long __hitWindow
private static long __MaxMisses
private String _formatString
private String _tzFormatString
private SimpleDateFormat _tzFormat
private String _minFormatString
private SimpleDateFormat _minFormat
private String _secFormatString
private String _secFormatString0
private String _secFormatString1
private boolean _millis
private long _misses
private long _lastMinutes
private long _lastSeconds
private String _lastResult
private Locale _locale
private DateFormatSymbols _dfs
Constructor Detail |
---|
public DateCache()
public DateCache(String format)
public DateCache(String format, Locale l)
public DateCache(String format, DateFormatSymbols s)
Method Detail |
---|
public void setTimeZone(TimeZone tz)
tz
- TimeZonepublic TimeZone getTimeZone()
public void setTimeZoneID(String timeZoneId)
timeZoneId
- TimeZoneId the ID of the zone as used by
TimeZone.getTimeZone(id)private void setTzFormatString(TimeZone tz)
private void setMinFormatString()
public String format(Date inDate)
inDate
-
public String format(long inDate)
inDate
-
public void format(long inDate, StringBuffer buffer)
inDate
- Date the formatbuffer
- StringBufferpublic SimpleDateFormat getFormat()
public String getFormatString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |