nan.tools
Class NNTPDateFormat

java.lang.Object
  extended bynan.tools.NNTPDateFormat

public class NNTPDateFormat
extends java.lang.Object

A helper class for static date formatting methods as required to implement the RFC 850 news message standard.

Version:
1.5, 12/28/03
Author:
John David Ratliff

Field Summary
static java.text.SimpleDateFormat DISPLAY_FORMAT
          The format for displaying a date and time.
static java.text.SimpleDateFormat[] FORMATS
          The potential date formats that can be parsed.
static java.text.SimpleDateFormat SINCE_FORMAT
          The format for 'since when' date-times like NEWNEWS and NEWGROUPS NNTP commands.
 
Method Summary
static java.util.Date parseDate(java.lang.String text)
          Parses an NNTP date string into a Date object.
static java.lang.String toDisplayString(java.util.Date date)
          Parses a Date object into a display date-time String.
static java.lang.String toSinceDateString(java.util.Date date)
          Parses a Date object into a 'since when' date-time String as required by commands like NEWNEWS and NEWGROUPS.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORMATS

public static final java.text.SimpleDateFormat[] FORMATS
The potential date formats that can be parsed.


SINCE_FORMAT

public static final java.text.SimpleDateFormat SINCE_FORMAT
The format for 'since when' date-times like NEWNEWS and NEWGROUPS NNTP commands.


DISPLAY_FORMAT

public static final java.text.SimpleDateFormat DISPLAY_FORMAT
The format for displaying a date and time.

Method Detail

toSinceDateString

public static java.lang.String toSinceDateString(java.util.Date date)
Parses a Date object into a 'since when' date-time String as required by commands like NEWNEWS and NEWGROUPS.

Parameters:
date - The Date object to format.
Returns:
The parsed date String.

toDisplayString

public static java.lang.String toDisplayString(java.util.Date date)
Parses a Date object into a display date-time String.

Parameters:
date - The Date to format.
Returns:
The formatted String.

parseDate

public static java.util.Date parseDate(java.lang.String text)
                                throws BadDateFormatException
Parses an NNTP date string into a Date object.

Parameters:
text - The date string to parse.
Returns:
The Date object encapsulating this date string.
Throws:
BadDateFormatException - if the date string is in an unknown or unparsable format.