- java.lang.Object
-
- io.netty5.handler.codec.DateFormatter
-
public final class DateFormatter extends Object
A formatter for HTTP header dates, such as "Expires" and "Date" headers, or "expires" field in "Set-Cookie". On the parsing side, it honors RFC6265 (so it supports RFC1123). Note that:- Day of week is ignored and not validated
- Timezone is ignored, as RFC6265 assumes UTC
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringBuilderappend(Date date, StringBuilder sb)Append aDateto aStringBuilderinto RFC1123 formatstatic Stringformat(Date date)Format aDateinto RFC1123 formatstatic DateparseHttpDate(CharSequence txt)Parse some text into aDate, according to RFC6265static DateparseHttpDate(CharSequence txt, int start, int end)Parse some text into aDate, according to RFC6265voidreset()
-
-
-
Method Detail
-
parseHttpDate
public static Date parseHttpDate(CharSequence txt)
Parse some text into aDate, according to RFC6265- Parameters:
txt- text to parse- Returns:
- a
Date, or null if text couldn't be parsed
-
parseHttpDate
public static Date parseHttpDate(CharSequence txt, int start, int end)
Parse some text into aDate, according to RFC6265- Parameters:
txt- text to parsestart- the start index insidetxtend- the end index insidetxt- Returns:
- a
Date, or null if text couldn't be parsed
-
format
public static String format(Date date)
Format aDateinto RFC1123 format- Parameters:
date- the date to format- Returns:
- a RFC1123 string
-
append
public static StringBuilder append(Date date, StringBuilder sb)
Append aDateto aStringBuilderinto RFC1123 format- Parameters:
date- the date to formatsb- the StringBuilder- Returns:
- the same StringBuilder
-
reset
public void reset()
-
-