gnu.inet.http

Class HTTPDateFormat


public class HTTPDateFormat
extends DateFormat

HTTP date formatter and parser. Formats dates according to RFC 822 (updated by RFC 1123). Parses dates according to the above, or RFC 1036, or the ANSI C asctime() format.

Author:
Chris Burdess

Constructor Summary

HTTPDateFormat()

Method Summary

StringBuffer
format(Date date, StringBuffer buf, FieldPosition field)
Appends the textual value for the specified field to the given string buffer.
Date
parse(String text, ParsePosition pos)
Parses the given date in the current TimeZone.
void
setCalendar(Calendar newCalendar)
Don't allow setting the calendar.
void
setNumberFormat(NumberFormat newNumberFormat)
Don't allow setting the NumberFormat.

Constructor Details

HTTPDateFormat

public HTTPDateFormat()

Method Details

format

public StringBuffer format(Date date,
                           StringBuffer buf,
                           FieldPosition field)
Appends the textual value for the specified field to the given string buffer. This method should be avoided, use format(Date) instead.

Parameters:
date - the Date object
buf - the buffer to append to
field - the current field position

Returns:
the modified buffer


parse

public Date parse(String text,
                  ParsePosition pos)
Parses the given date in the current TimeZone.

Parameters:
text - the formatted date to be parsed
pos - the current parse position


setCalendar

public void setCalendar(Calendar newCalendar)
Don't allow setting the calendar.


setNumberFormat

public void setNumberFormat(NumberFormat newNumberFormat)
Don't allow setting the NumberFormat.


© Copyright 2003 The Free Software Foundation, all rights reserved