Class FastHttpDateFormat


  • public final class FastHttpDateFormat
    extends java.lang.Object
    Utility class to generate HTTP dates.
    Author:
    Gustav Trede, Remy Maucherat
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String formatDate​(long value, java.text.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 . truncation is done in the same way for second precision in SimpleDateFormat:
      (999 millisec. = 0 sec.)
      static java.lang.String getCurrentDate()
      Get the current date in HTTP format.
      static byte[] getCurrentDateBytes()
      Get the current date in HTTP format.
      static long parseDate​(java.lang.String value, java.text.DateFormat[] threadLocalformats)
      Try to parse the given date as a HTTP date.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FastHttpDateFormat

        public FastHttpDateFormat()
    • Method Detail

      • getCurrentDate

        public static java.lang.String getCurrentDate()
        Get the current date in HTTP format.
      • getCurrentDateBytes

        public static byte[] getCurrentDateBytes()
        Get the current date in HTTP format.
      • formatDate

        public static java.lang.String formatDate​(long value,
                                                  java.text.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 . truncation is done in the same way for second precision in SimpleDateFormat:
        (999 millisec. = 0 sec.)
        Parameters:
        value - in milli-seconds
        threadLocalFormat - the DateFormat used if cache value was not found
      • parseDate

        public static long parseDate​(java.lang.String value,
                                     java.text.DateFormat[] threadLocalformats)
        Try to parse the given date as a HTTP date.