rabbit.http
Class HttpDateParser

java.lang.Object
  extended by rabbit.http.HttpDateParser

public class HttpDateParser
extends Object

A utility class that parses date in the http headers. A date in http may be written in many different formats so try them all.

Author:
Robert Olofsson

Constructor Summary
HttpDateParser()
          The default constructor.
 
Method Summary
static Date getDate(String date)
          Try to get a date from the given string.
static String getDateString(Date d)
          Get a String from the date.
static void main(String[] args)
          Simple self test method.
static void setOffset(long offset)
          Set the time offset relative GMT.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpDateParser

public HttpDateParser()
The default constructor.

Method Detail

setOffset

public static void setOffset(long offset)
Set the time offset relative GMT.


getDate

public static Date getDate(String date)
Try to get a date from the given string. According to RFC 2068 We have to read 3 formats.

Parameters:
date - the String we are trying to parse.
Returns:
a Date or null if parsing was not possible.

getDateString

public static String getDateString(Date d)
Get a String from the date.

Parameters:
d - the Date to format.
Returns:
a String describing the date in the right way.

main

public static void main(String[] args)
Simple self test method.