com.go.trove.util
Class FastDateFormat
java.lang.Object
|
+--com.go.trove.util.FastDateFormat
- public class FastDateFormat
- extends java.lang.Object
Similar to SimpleDateFormat, but faster and thread-safe.
Only formatting is supported, but all patterns are compatible with
SimpleDateFormat.
- Version:
- 4 , 01/07/03
- Author:
- Brian S O'Neill
|
Field Summary |
static java.lang.Object |
FULL
Style pattern |
static java.lang.Object |
LONG
Style pattern |
static java.lang.Object |
MEDIUM
Style pattern |
static java.lang.Object |
SHORT
Style pattern |
|
Method Summary |
java.lang.String |
format(java.util.Calendar calendar)
|
java.lang.StringBuffer |
format(java.util.Calendar calendar,
java.lang.StringBuffer buf)
|
java.lang.String |
format(java.util.Date date)
|
java.lang.StringBuffer |
format(java.util.Date date,
java.lang.StringBuffer buf)
|
static FastDateFormat |
getDateInstance(java.lang.Object style,
java.util.TimeZone timeZone,
java.util.Locale locale)
|
static FastDateFormat |
getDateTimeInstance(java.lang.Object dateStyle,
java.lang.Object timeStyle,
java.util.TimeZone timeZone,
java.util.Locale locale)
|
static FastDateFormat |
getInstance()
|
static FastDateFormat |
getInstance(java.lang.String pattern)
|
static FastDateFormat |
getInstance(java.lang.String pattern,
java.text.DateFormatSymbols symbols)
|
static FastDateFormat |
getInstance(java.lang.String pattern,
java.util.Locale locale)
|
static FastDateFormat |
getInstance(java.lang.String pattern,
java.util.TimeZone timeZone)
|
static FastDateFormat |
getInstance(java.lang.String pattern,
java.util.TimeZone timeZone,
java.util.Locale locale)
|
static FastDateFormat |
getInstance(java.lang.String pattern,
java.util.TimeZone timeZone,
java.util.Locale locale,
java.text.DateFormatSymbols symbols)
|
java.util.Locale |
getLocale()
|
int |
getMaxLengthEstimate()
Returns an estimate for the maximum length date that this date
formatter will produce. |
java.lang.String |
getPattern()
|
static FastDateFormat |
getTimeInstance(java.lang.Object style,
java.util.TimeZone timeZone,
java.util.Locale locale)
|
java.util.TimeZone |
getTimeZone()
Returns the time zone used by this formatter, or null if time zone of
formatted dates is used instead. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FULL
public static final java.lang.Object FULL
- Style pattern
LONG
public static final java.lang.Object LONG
- Style pattern
MEDIUM
public static final java.lang.Object MEDIUM
- Style pattern
SHORT
public static final java.lang.Object SHORT
- Style pattern
getInstance
public static FastDateFormat getInstance()
getInstance
public static FastDateFormat getInstance(java.lang.String pattern)
throws java.lang.IllegalArgumentException
- Parameters:
pattern - SimpleDateFormat compatible pattern
getInstance
public static FastDateFormat getInstance(java.lang.String pattern,
java.util.TimeZone timeZone)
throws java.lang.IllegalArgumentException
- Parameters:
pattern - SimpleDateFormat compatible patterntimeZone - optional time zone, overrides time zone of formatted
date
getInstance
public static FastDateFormat getInstance(java.lang.String pattern,
java.util.Locale locale)
throws java.lang.IllegalArgumentException
- Parameters:
pattern - SimpleDateFormat compatible patternlocale - optional locale, overrides system locale
getInstance
public static FastDateFormat getInstance(java.lang.String pattern,
java.text.DateFormatSymbols symbols)
throws java.lang.IllegalArgumentException
- Parameters:
pattern - SimpleDateFormat compatible patternsymbols - optional date format symbols, overrides symbols for
system locale
getInstance
public static FastDateFormat getInstance(java.lang.String pattern,
java.util.TimeZone timeZone,
java.util.Locale locale)
throws java.lang.IllegalArgumentException
- Parameters:
pattern - SimpleDateFormat compatible patterntimeZone - optional time zone, overrides time zone of formatted
datelocale - optional locale, overrides system locale
getInstance
public static FastDateFormat getInstance(java.lang.String pattern,
java.util.TimeZone timeZone,
java.util.Locale locale,
java.text.DateFormatSymbols symbols)
throws java.lang.IllegalArgumentException
- Parameters:
pattern - SimpleDateFormat compatible patterntimeZone - optional time zone, overrides time zone of formatted
datelocale - optional locale, overrides system localesymbols - optional date format symbols, overrides symbols for
provided locale
getDateInstance
public static FastDateFormat getDateInstance(java.lang.Object style,
java.util.TimeZone timeZone,
java.util.Locale locale)
throws java.lang.IllegalArgumentException
- Parameters:
style - date style: FULL, LONG, MEDIUM, or SHORTtimeZone - optional time zone, overrides time zone of formatted
datelocale - optional locale, overrides system locale
getTimeInstance
public static FastDateFormat getTimeInstance(java.lang.Object style,
java.util.TimeZone timeZone,
java.util.Locale locale)
throws java.lang.IllegalArgumentException
- Parameters:
style - time style: FULL, LONG, MEDIUM, or SHORTtimeZone - optional time zone, overrides time zone of formatted
datelocale - optional locale, overrides system locale
getDateTimeInstance
public static FastDateFormat getDateTimeInstance(java.lang.Object dateStyle,
java.lang.Object timeStyle,
java.util.TimeZone timeZone,
java.util.Locale locale)
throws java.lang.IllegalArgumentException
- Parameters:
dateStyle - date style: FULL, LONG, MEDIUM, or SHORTtimeStyle - time style: FULL, LONG, MEDIUM, or SHORTtimeZone - optional time zone, overrides time zone of formatted
datelocale - optional locale, overrides system locale
format
public java.lang.String format(java.util.Date date)
format
public java.lang.String format(java.util.Calendar calendar)
format
public java.lang.StringBuffer format(java.util.Date date,
java.lang.StringBuffer buf)
format
public java.lang.StringBuffer format(java.util.Calendar calendar,
java.lang.StringBuffer buf)
getPattern
public java.lang.String getPattern()
getTimeZone
public java.util.TimeZone getTimeZone()
- Returns the time zone used by this formatter, or null if time zone of
formatted dates is used instead.
getLocale
public java.util.Locale getLocale()
getMaxLengthEstimate
public int getMaxLengthEstimate()
- Returns an estimate for the maximum length date that this date
formatter will produce. The actual formatted length will almost always
be less than or equal to this amount.