org.eclipse.jetty.util

## Class DateCache

- java.lang.Object
- - org.eclipse.jetty.util.DateCache

- Direct Known Subclasses:
    BufferDateCache

      public class DateCache
      extends java.lang.Object

  Date Format Cache. Computes String representations of Dates and caches the results so that subsequent requests within the same minute will be fast. Only format strings that contain either "ss" or "ss.SSS" are handled. The timezone of the date may be included as an ID with the "zzz" format string or as an offset with the "ZZZ" format string. If consecutive calls are frequently very different, then this may be a little slower than a normal DateFormat.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `DEFAULT_FORMAT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DateCache()` Constructor.
    `DateCache(java.lang.String format)` Constructor.
    `DateCache(java.lang.String format, java.text.DateFormatSymbols s)`
    `DateCache(java.lang.String format, java.util.Locale l)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `format(java.util.Date inDate)` Format a date according to our stored formatter.
    `java.lang.String` | `format(long inDate)` Format a date according to our stored formatter.
    `void` | `format(long inDate, java.lang.StringBuilder buffer)` Format to string buffer.
    `java.text.SimpleDateFormat` | `getFormat()` Get the format.
    `java.lang.String` | `getFormatString()`
    `java.util.TimeZone` | `getTimeZone()`
    `int` | `lastMs()`
    `java.lang.String` | `now()`
    `void` | `setTimeZone(java.util.TimeZone tz)` Set the timezone.
    `void` | `setTimeZoneID(java.lang.String timeZoneId)` Set the timezone.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_FORMAT

          public static java.lang.String DEFAULT_FORMAT

  - ### Constructor Detail

    - #### DateCache

          public DateCache()

      Constructor. Make a DateCache that will use a default format. The default format generates the same results as Date.toString().

    - #### DateCache

          public DateCache(java.lang.String format)

      Constructor. Make a DateCache that will use the given format

    - #### DateCache

          public DateCache(java.lang.String format,
                   java.util.Locale l)

    - #### DateCache

          public DateCache(java.lang.String format,
                   java.text.DateFormatSymbols s)

  - ### Method Detail

    - #### setTimeZone

          public void setTimeZone(java.util.TimeZone tz)

      Set the timezone.
      Parameters:
        `tz` - TimeZone

    - #### getTimeZone

          public java.util.TimeZone getTimeZone()

    - #### setTimeZoneID

          public void setTimeZoneID(java.lang.String timeZoneId)

      Set the timezone.
      Parameters:
        `timeZoneId` - TimeZoneId the ID of the zone as used by TimeZone.getTimeZone(id)

    - #### format

          public java.lang.String format(java.util.Date inDate)

      Format a date according to our stored formatter.
      Parameters:
        `inDate` -
      Returns:
        Formatted date

    - #### format

          public java.lang.String format(long inDate)

      Format a date according to our stored formatter.
      Parameters:
        `inDate` -
      Returns:
        Formatted date

    - #### format

          public void format(long inDate,
                    java.lang.StringBuilder buffer)

      Format to string buffer.
      Parameters:
        `inDate` - Date the format
        `buffer` - StringBuilder

    - #### getFormat

          public java.text.SimpleDateFormat getFormat()

      Get the format.

    - #### getFormatString

          public java.lang.String getFormatString()

    - #### now

          public java.lang.String now()

    - #### lastMs

          public int lastMs()

Copyright © 2013 FuseSource, Corp.. All Rights Reserved.