public final class FastHttpDateFormat extends Object
Modifier and Type | Field and Description |
---|---|
protected static int |
CACHE_SIZE |
protected static String |
currentDate
Current formatted date.
|
protected static ConcurrentMap<Long,String> |
formatCache
Formatter cache.
|
protected static ThreadLocal |
FORMATS
ThreadLocal for the set of SimpleDateFormat formats to use in getDateHeader().
|
protected static TimeZone |
GMT_TIME_ZONE |
protected static long |
nextGeneration
Instant on which the currentDate object was generated.
|
protected static ConcurrentMap<String,Long> |
parseCache
Parser cache.
|
Constructor and Description |
---|
FastHttpDateFormat() |
Modifier and Type | Method and Description |
---|---|
static String |
formatDate(long value,
DateFormat threadLocalFormat)
Get the HTTP format of the specified date.
http spec only requre second precision http://tools.ietf.org/html/rfc2616#page-20 therefore we dont use the millisecond precision , but second . |
static String |
getCurrentDate()
Get the current date in HTTP format.
|
static long |
parseDate(String value,
DateFormat[] threadLocalformats)
Try to parse the given date as a HTTP date.
|
protected static final int CACHE_SIZE
protected static final TimeZone GMT_TIME_ZONE
protected static final ThreadLocal FORMATS
protected static volatile long nextGeneration
protected static volatile String currentDate
protected static final ConcurrentMap<Long,String> formatCache
protected static final ConcurrentMap<String,Long> parseCache
public static String getCurrentDate()
public static String formatDate(long value, DateFormat threadLocalFormat)
value
- in milli-secondsthreadLocalFormat
- the DateFormat
used if cache value was
not foundpublic static long parseDate(String value, DateFormat[] threadLocalformats)
Copyright © 2014 Oracle Corporation. All rights reserved.