public class FastDateParser extends java.lang.Object implements DateParser, java.io.Serializable
FastDateParser is a fast and thread-safe version of
 SimpleDateFormat.
To obtain a proxy to a FastDateParser, use FastDateFormat.getInstance(String, TimeZone, Locale)
 or another variation of the factory methods of FastDateFormat.
Since FastDateParser is thread safe, you can use a static member instance:
     private static final DateParser DATE_PARSER = FastDateFormat.getInstance("yyyy-MM-dd");
 
 This class can be used as a direct replacement for
 SimpleDateFormat in most parsing situations.
 This class is especially useful in multi-threaded server environments.
 SimpleDateFormat is not thread-safe in any JDK version,
 nor will it be as Sun has closed the
 bug/RFE.
 
Only parsing is supported by this class, but all patterns are compatible with SimpleDateFormat.
The class operates in lenient mode, so for example a time of 90 minutes is treated as 1 hour 30 minutes.
Timing tests indicate this class is as about as fast as SimpleDateFormat in single thread applications and about 25% faster in multi-thread applications.
FastDatePrinter, 
Serialized Form| Modifier and Type | Method and Description | 
|---|---|
boolean | 
equals(java.lang.Object obj)
Compare another object for equality with this object. 
 | 
java.util.Locale | 
getLocale()
Gets the locale used by this parser. 
 | 
java.lang.String | 
getPattern()
Gets the pattern used by this parser. 
 | 
java.util.TimeZone | 
getTimeZone()
 Gets the time zone used by this parser. 
 | 
int | 
hashCode()
Return a hash code compatible with equals. 
 | 
java.util.Date | 
parse(java.lang.String source)
Equivalent to DateFormat.parse(String). 
 | 
java.util.Date | 
parse(java.lang.String source,
     java.text.ParsePosition pos)
This implementation updates the ParsePosition if the parse succeeds. 
 | 
boolean | 
parse(java.lang.String source,
     java.text.ParsePosition pos,
     java.util.Calendar calendar)
Parse a formatted date string according to the format. 
 | 
java.lang.Object | 
parseObject(java.lang.String source)
Parses text from a string to produce a Date. 
 | 
java.lang.Object | 
parseObject(java.lang.String source,
           java.text.ParsePosition pos)
Parses a date/time string according to the given parse position. 
 | 
java.lang.String | 
toString()
Get a string version of this formatter. 
 | 
public java.lang.String getPattern()
DateParserGets the pattern used by this parser.
getPattern in interface DateParserSimpleDateFormat compatiblepublic java.util.TimeZone getTimeZone()
DateParserGets the time zone used by this parser.
 The default TimeZone used to create a Date when the TimeZone is not specified by
 the format pattern.
 
getTimeZone in interface DateParserpublic java.util.Locale getLocale()
DateParserGets the locale used by this parser.
getLocale in interface DateParserpublic boolean equals(java.lang.Object obj)
Compare another object for equality with this object.
equals in class java.lang.Objectobj - the object to compare totrueif equal to this instancepublic int hashCode()
Return a hash code compatible with equals.
hashCode in class java.lang.Objectpublic java.lang.String toString()
Get a string version of this formatter.
toString in class java.lang.Objectpublic java.lang.Object parseObject(java.lang.String source)
                             throws java.text.ParseException
DateParserparseObject in interface DateParsersource - A String whose beginning should be parsed.java.util.Date objectjava.text.ParseException - if the beginning of the specified string cannot be parsed.Format.parseObject(String)public java.util.Date parse(java.lang.String source)
                     throws java.text.ParseException
DateParserDateFormat.parse(String) for more information.parse in interface DateParsersource - A String whose beginning should be parsed.Date parsed from the stringjava.text.ParseException - if the beginning of the specified string cannot be parsed.public java.lang.Object parseObject(java.lang.String source,
                                    java.text.ParsePosition pos)
DateParserparseObject in interface DateParsersource - A String whose beginning should be parsed.pos - the parse positionjava.util.Date objectDateFormat.parseObject(String, ParsePosition)public java.util.Date parse(java.lang.String source,
                            java.text.ParsePosition pos)
SimpleDateFormat.parse(String, ParsePosition) which sets
 the error index to after the failed field.
 
 To determine if the parse has succeeded, the caller must check if the current parse position
 given by ParsePosition.getIndex() has been updated. If the input buffer has been fully
 parsed, then the index will point to just after the end of the input buffer.
parse in interface DateParsersource - A String, part of which should be parsed.pos - A ParsePosition object with index and error index information
 as described above.Date parsed from the string. In case of error, returns null.DateParser.parse(java.lang.String, java.text.ParsePosition)public boolean parse(java.lang.String source,
                     java.text.ParsePosition pos,
                     java.util.Calendar calendar)
parse in interface DateParsersource - The text to parse.pos - On input, the position in the source to start parsing, on output, updated position.calendar - The calendar into which to set parsed fields.java.lang.IllegalArgumentException - when Calendar has been set to be not lenient, and a parsed field is
 out of range."Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"