Package io.netty.handler.codec
Class DateFormatter
- java.lang.Object
-
- io.netty.handler.codec.DateFormatter
-
public final class DateFormatter extends java.lang.ObjectA 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 java.lang.StringBuilderappend(java.util.Date date, java.lang.StringBuilder sb)Append aDateto aStringBuilderinto RFC1123 formatstatic java.lang.Stringformat(java.util.Date date)Format aDateinto RFC1123 formatstatic java.util.DateparseHttpDate(java.lang.CharSequence txt)Parse some text into aDate, according to RFC6265static java.util.DateparseHttpDate(java.lang.CharSequence txt, int start, int end)Parse some text into aDate, according to RFC6265voidreset()
-
-
-
Method Detail
-
parseHttpDate
public static java.util.Date parseHttpDate(java.lang.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 java.util.Date parseHttpDate(java.lang.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 java.lang.String format(java.util.Date date)
Format aDateinto RFC1123 format- Parameters:
date- the date to format- Returns:
- a RFC1123 string
-
append
public static java.lang.StringBuilder append(java.util.Date date, java.lang.StringBuilder sb)Append aDateto aStringBuilderinto RFC1123 format- Parameters:
date- the date to formatsb- the StringBuilder- Returns:
- the same StringBuilder
-
reset
public void reset()
-
-