Top Description Fields Constructors Methods
com.oracle.bmc.http.internal

public Class HttpDateUtils

extends Object
Class Inheritance
Annotations
@SuppressWarnings:deprecation
Imports
java.text.DateFormat, .ParseException, .SimpleDateFormat, java.time.Instant, .LocalDate, .LocalTime, .ZoneOffset, .ZonedDateTime, java.time.format.DateTimeFormatter, .DateTimeFormatterBuilder, .DateTimeParseException, java.time.temporal.TemporalQueries, java.util.ArrayList, .Calendar, .Date, .List, .Locale, .Optional, .TimeZone

Date parsing utils.

Handles reusing date formatters, as well as which date formats that will be used to parse various headers.

Field Summary

Modifier and TypeField and Description
private static final Date
private static DateTimeFormatter
private static final Logger
private static final ThreadLocal<List<DateFormat>>
private static final TimeZone

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static List<DateFormat>
public static String

Returns:

The formatted date.
format
(Date
The date to format.
date
)

Format the given date into Swagger RFC3339 date-time format.

public static String

Returns:

Formatted date.
formatAlwaysIncludeMillis
(Date
The date to format.
date
)

Format the given date into Swagger RFC3339 date-time format.

private static void
init(List<DateFormat> formats)

pack-priv static Date

Returns:

A new Date instance, or null if it could not be parsed.
parse
(String
The header name.
headerName
,
String
The header value.
value
)

Attempts to parse the given header into a Date instance.

private static Date
tryParse(String date, List<DateFormat> formats)

private static Date
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

AMBIGUOUS_YEAR_TWO_DIGIT_YEAR_STARTback to summary
private static final Date AMBIGUOUS_YEAR_TWO_DIGIT_YEAR_START
ISO_INSTANT_INCLUDE_MILLISback to summary
private static DateTimeFormatter ISO_INSTANT_INCLUDE_MILLIS
LOGback to summary
private static final Logger LOG
RFC2616_DATE_FORMATSback to summary
private static final ThreadLocal<List<DateFormat>> RFC2616_DATE_FORMATS
TIMEZONE_GMTback to summary
private static final TimeZone TIMEZONE_GMT

Constructor Detail

HttpDateUtilsback to summary
public HttpDateUtils()

Method Detail

createRfc2616DateFormatsback to summary
private static List<DateFormat> createRfc2616DateFormats()
formatback to summary
public static String format(Date date)

Format the given date into Swagger RFC3339 date-time format. Milliseconds won't be included if they are zero.

Parameters
date:Date

The date to format.

Returns:String

The formatted date.

formatAlwaysIncludeMillisback to summary
public static String formatAlwaysIncludeMillis(Date date)

Format the given date into Swagger RFC3339 date-time format. Milliseconds will always be included.

Parameters
date:Date

The date to format.

Returns:String

Formatted date.

initback to summary
private static void init(List<DateFormat> formats)
parseback to summary
pack-priv static Date parse(String headerName, String value)

Attempts to parse the given header into a Date instance.

Parameters
headerName:String

The header name.

value:String

The header value.

Returns:Date

A new Date instance, or null if it could not be parsed.

tryParseback to summary
private static Date tryParse(String date, List<DateFormat> formats)
tryParseRfc3339back to summary
private static Date tryParseRfc3339(String date)