- 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 StringBuilder
append(Date date, StringBuilder sb)
Append aDate
to aStringBuilder
into RFC1123 formatstatic String
format(Date date)
Format aDate
into RFC1123 formatstatic Date
parseHttpDate(CharSequence txt)
Parse some text into aDate
, according to RFC6265static Date
parseHttpDate(CharSequence txt, int start, int end)
Parse some text into aDate
, according to RFC6265void
reset()
-
-
-
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 insidetxt
end
- the end index insidetxt
- Returns:
- a
Date
, or null if text couldn't be parsed
-
format
public static String format(Date date)
Format aDate
into RFC1123 format- Parameters:
date
- the date to format- Returns:
- a RFC1123 string
-
append
public static StringBuilder append(Date date, StringBuilder sb)
Append aDate
to aStringBuilder
into RFC1123 format- Parameters:
date
- the date to formatsb
- the StringBuilder- Returns:
- the same StringBuilder
-
reset
public void reset()
-
-