public class FastDatePrinter extends AbstractDateBasic implements DatePrinter
FastDateParser
,
Serialized Formlocale, pattern, timeZone
Constructor and Description |
---|
FastDatePrinter(String pattern,
TimeZone timeZone,
Locale locale)
构造,内部使用
|
Modifier and Type | Method and Description |
---|---|
String |
format(Calendar calendar)
Formats a
Calendar object. |
<B extends Appendable> |
format(Calendar calendar,
B buf)
Formats a
Calendar object into the supplied Appendable . |
String |
format(Date date)
使用
GregorianCalendar 格式化 Date |
<B extends Appendable> |
format(Date date,
B buf)
Formats a
Date object into the supplied Appendable using a GregorianCalendar . |
String |
format(long millis)
格式化日期表示的毫秒数
|
<B extends Appendable> |
format(long millis,
B buf)
Formats a millisecond
long value into the supplied Appendable . |
int |
getMaxLengthEstimate()
估算生成的日期字符串长度
实际生成的字符串长度小于或等于此值 |
protected List<cn.hutool.core.date.format.FastDatePrinter.Rule> |
parsePattern()
Returns a list of Rules given a pattern.
|
protected String |
parseToken(String pattern,
int[] indexRef)
Performs the parsing of tokens.
|
protected cn.hutool.core.date.format.FastDatePrinter.NumberRule |
selectNumberRule(int field,
int padding)
Gets an appropriate rule for the padding required.
|
equals, getLocale, getPattern, getTimeZone, hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getLocale, getPattern, getTimeZone
protected List<cn.hutool.core.date.format.FastDatePrinter.Rule> parsePattern()
Returns a list of Rules given a pattern.
List
of Rule objectsIllegalArgumentException
- if pattern is invalidprotected String parseToken(String pattern, int[] indexRef)
Performs the parsing of tokens.
pattern
- the patternindexRef
- index referencesprotected cn.hutool.core.date.format.FastDatePrinter.NumberRule selectNumberRule(int field, int padding)
Gets an appropriate rule for the padding required.
field
- the field to get a rule forpadding
- the padding requiredpublic String format(long millis)
DatePrinter
format
in interface DatePrinter
millis
- 日期毫秒数public String format(Date date)
DatePrinter
GregorianCalendar
格式化 Date
format
in interface DatePrinter
date
- 日期 Date
public String format(Calendar calendar)
DatePrinter
Formats a Calendar
object.
Calendar
format
in interface DatePrinter
calendar
- Calendar
public <B extends Appendable> B format(long millis, B buf)
DatePrinter
Formats a millisecond long
value into the supplied Appendable
.
format
in interface DatePrinter
B
- the Appendable class type, usually StringBuilder or StringBuffer.millis
- the millisecond value to formatbuf
- the buffer to format intopublic <B extends Appendable> B format(Date date, B buf)
DatePrinter
Formats a Date
object into the supplied Appendable
using a GregorianCalendar
.
format
in interface DatePrinter
B
- the Appendable class type, usually StringBuilder or StringBuffer.date
- the date to formatbuf
- the buffer to format intopublic <B extends Appendable> B format(Calendar calendar, B buf)
DatePrinter
Formats a Calendar
object into the supplied Appendable
.
format
in interface DatePrinter
B
- the Appendable class type, usually StringBuilder or StringBuffer.calendar
- the calendar to formatbuf
- the buffer to format intopublic int getMaxLengthEstimate()
Copyright © 2024. All rights reserved.