Class HttpDateFormat


  • public final class HttpDateFormat
    extends java.lang.Object
    Helper class for HTTP specified date formats.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private HttpDateFormat()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.util.List<java.text.SimpleDateFormat> createDateFormats()  
      private static java.util.List<java.text.SimpleDateFormat> getDateFormats()
      Return an unmodifiable list of HTTP specified date formats to use for parsing or formatting Date.
      static java.text.SimpleDateFormat getPreferredDateFormat()
      Get the preferred HTTP specified date format (RFC 1123).
      static java.util.Date readDate​(java.lang.String date)
      Read a date.
      • Methods inherited from class java.lang.Object

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

      • RFC1123_DATE_FORMAT_PATTERN

        private static final java.lang.String RFC1123_DATE_FORMAT_PATTERN
        The date format pattern for RFC 1123.
        See Also:
        Constant Field Values
      • RFC1036_DATE_FORMAT_PATTERN

        private static final java.lang.String RFC1036_DATE_FORMAT_PATTERN
        The date format pattern for RFC 1036.
        See Also:
        Constant Field Values
      • ANSI_C_ASCTIME_DATE_FORMAT_PATTERN

        private static final java.lang.String ANSI_C_ASCTIME_DATE_FORMAT_PATTERN
        The date format pattern for ANSI C asctime().
        See Also:
        Constant Field Values
      • GMT_TIME_ZONE

        private static final java.util.TimeZone GMT_TIME_ZONE
      • dateFormats

        private static final java.lang.ThreadLocal<java.util.List<java.text.SimpleDateFormat>> dateFormats
    • Constructor Detail

      • HttpDateFormat

        private HttpDateFormat()
    • Method Detail

      • createDateFormats

        private static java.util.List<java.text.SimpleDateFormat> createDateFormats()
      • getDateFormats

        private static java.util.List<java.text.SimpleDateFormat> getDateFormats()
        Return an unmodifiable list of HTTP specified date formats to use for parsing or formatting Date.

        The list of date formats are scoped to the current thread and may be used without requiring to synchronize access to the instances when parsing or formatting.

        Returns:
        the list of data formats.
      • getPreferredDateFormat

        public static java.text.SimpleDateFormat getPreferredDateFormat()
        Get the preferred HTTP specified date format (RFC 1123).

        The date format is scoped to the current thread and may be used without requiring to synchronize access to the instance when parsing or formatting.

        Returns:
        the preferred of data format.
      • readDate

        public static java.util.Date readDate​(java.lang.String date)
                                       throws java.text.ParseException
        Read a date.
        Parameters:
        date - the date as a string.
        Returns:
        the date
        Throws:
        java.text.ParseException - in case the date string cannot be parsed.