org.apache.jcs.utils.date
Class ThreadSafeSimpleDateFormat

java.lang.Object
  extended by java.text.Format
      extended by java.text.DateFormat
          extended by java.text.SimpleDateFormat
              extended by org.apache.jcs.utils.date.ThreadSafeSimpleDateFormat
All Implemented Interfaces:
Serializable, Cloneable

public class ThreadSafeSimpleDateFormat
extends SimpleDateFormat

Thread Safe version of SimpleDateFormat

This class simply synchronizes format and parse for SimpleDateFormat.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.text.DateFormat
DateFormat.Field
 
Field Summary
 
Fields inherited from class java.text.DateFormat
AM_PM_FIELD, calendar, DATE_FIELD, DAY_OF_WEEK_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, ERA_FIELD, FULL, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, HOUR0_FIELD, HOUR1_FIELD, LONG, MEDIUM, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, numberFormat, SECOND_FIELD, SHORT, TIMEZONE_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD
 
Constructor Summary
ThreadSafeSimpleDateFormat()
          Empty Constructor
ThreadSafeSimpleDateFormat(String pattern)
           
ThreadSafeSimpleDateFormat(String pattern, boolean lenient)
           
ThreadSafeSimpleDateFormat(String pattern, DateFormatSymbols formatSymbols)
           
ThreadSafeSimpleDateFormat(String pattern, Locale locale)
           
 
Method Summary
 StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition)
           
 Date parse(String source, ParsePosition pos)
           
 
Methods inherited from class java.text.SimpleDateFormat
applyLocalizedPattern, applyPattern, clone, equals, formatToCharacterIterator, get2DigitYearStart, getDateFormatSymbols, hashCode, set2DigitYearStart, setDateFormatSymbols, toLocalizedPattern, toPattern
 
Methods inherited from class java.text.DateFormat
format, format, getAvailableLocales, getCalendar, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getNumberFormat, getTimeInstance, getTimeInstance, getTimeInstance, getTimeZone, isLenient, parse, parseObject, setCalendar, setLenient, setNumberFormat, setTimeZone
 
Methods inherited from class java.text.Format
format, parseObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadSafeSimpleDateFormat

public ThreadSafeSimpleDateFormat()
Empty Constructor


ThreadSafeSimpleDateFormat

public ThreadSafeSimpleDateFormat(String pattern)
Parameters:
pattern - the pattern describing the date and time format

ThreadSafeSimpleDateFormat

public ThreadSafeSimpleDateFormat(String pattern,
                                  boolean lenient)
Parameters:
pattern - the pattern describing the date and time format
lenient - leniency option - if false, strictly valid dates are enforced

ThreadSafeSimpleDateFormat

public ThreadSafeSimpleDateFormat(String pattern,
                                  Locale locale)
Parameters:
pattern - the pattern describing the date and time format
locale - the locale whose date format symbols should be used.

ThreadSafeSimpleDateFormat

public ThreadSafeSimpleDateFormat(String pattern,
                                  DateFormatSymbols formatSymbols)
Parameters:
pattern - the pattern describing the date and time format
formatSymbols - the date format symbols to be used for formatting.
Method Detail

format

public StringBuffer format(Date date,
                           StringBuffer toAppendTo,
                           FieldPosition fieldPosition)
Overrides:
format in class SimpleDateFormat
Parameters:
date - date
toAppendTo - buffer to append to
fieldPosition - field position
Returns:
a string buffer with more data in it

parse

public Date parse(String source,
                  ParsePosition pos)
Overrides:
parse in class SimpleDateFormat
Parameters:
source - source
pos - parse position
Returns:
date


Copyright © 2002-2012 Apache Software Foundation. All Rights Reserved.