Class FastDateParser
java.lang.Object
org.aoju.bus.core.date.formatter.AbstractMotd
org.aoju.bus.core.date.formatter.parser.FastDateParser
- All Implemented Interfaces:
Serializable,DateMotd,DateParser,PositionDateParser
SimpleDateFormat 的线程安全版本 用于解析日期字符串并转换为 Date 对象- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Field Summary
Fields inherited from class org.aoju.bus.core.date.formatter.AbstractMotd
locale, pattern, timeZone -
Constructor Summary
ConstructorsConstructorDescriptionFastDateParser(String pattern, TimeZone timeZone, Locale locale) 构造一个新的FastDateParser 使用FormatBuilder.getInstance(String, TimeZone, Locale)或FormatBuilder工厂方法的另一种变体来获取缓存的FastDateParser实例FastDateParser(String pattern, TimeZone timeZone, Locale locale, Date centuryStart) 构造一个新的FastDateParser -
Method Summary
Modifier and TypeMethodDescription将日期字符串解析并转换为Date对象 等价于DateFormat.parse(String)parse(String source, ParsePosition pos) 将日期字符串解析并转换为Date对象 等价于DateFormat.parse(String, ParsePosition)booleanparse(String source, ParsePosition pos, Calendar calendar) 根据给定格式更新CalendarMethods inherited from class org.aoju.bus.core.date.formatter.AbstractMotd
equals, getLocale, getPattern, getTimeZone, hashCode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.aoju.bus.core.date.formatter.DateMotd
getLocale, getPattern, getTimeZoneMethods inherited from interface org.aoju.bus.core.date.formatter.parser.DateParser
parseObjectMethods inherited from interface org.aoju.bus.core.date.formatter.parser.PositionDateParser
parseObject
-
Constructor Details
-
FastDateParser
构造一个新的FastDateParser 使用FormatBuilder.getInstance(String, TimeZone, Locale)或FormatBuilder工厂方法的另一种变体来获取缓存的FastDateParser实例- Parameters:
pattern- 非空SimpleDateFormat兼容模式timeZone- 非空时区locale- 非空地区
-
FastDateParser
构造一个新的FastDateParser- Parameters:
pattern- 非空SimpleDateFormat兼容模式timeZone- 非空时区locale- 非空地区centuryStart- 本世纪初为2位数年解析
-
-
Method Details
-
parse
Description copied from interface:DateParser将日期字符串解析并转换为Date对象 等价于DateFormat.parse(String)- Specified by:
parsein interfaceDateParser- Parameters:
source- 被解析的日期字符串- Returns:
Date对象- Throws:
ParseException- 转换异常,被转换的字符串格式错误。
-
parse
Description copied from interface:PositionDateParser将日期字符串解析并转换为Date对象 等价于DateFormat.parse(String, ParsePosition)- Specified by:
parsein interfacePositionDateParser- Parameters:
source- 日期字符串pos-ParsePosition- Returns:
Date
-
parse
Description copied from interface:PositionDateParser根据给定格式更新Calendar- Specified by:
parsein interfacePositionDateParser- Parameters:
source- 被转换的日期字符串pos- 定义开始转换的位置,转换结束后更新转换到的位置calendar- 要将解析字段设置到其中的日历- Returns:
- true
-