FileDocCategorySizeDatePackage
DateParser.javaAPI DocphoneME MR2 API (J2ME)2592Wed May 02 18:00:42 BST 2007gov.nist.siplite.parser

DateParser

public class DateParser extends HeaderParser
Parser for SIP Date field. Converts from SIP Date to the internal storage (Calendar).

Fields Summary
Constructors Summary
DateParser()
Default constructor.

public DateParser(String date)
Constructor with initial date header string.

param
date initial string to be parsed

        super(date);
    
protected DateParser(Lexer lexer)
Constructor with initial lexer engine.

param
lexer initial lexer engine

        super(lexer);
    
Methods Summary
public Headerparse()
Invokes parser for date header field.

return
the parsed date header

        if (debug) dbg_enter("DateParser.parse");
        try {
            headerName(TokenTypes.DATE);
            int w = wkday();
            lexer.match(',");
            lexer.match(' ");
            Calendar cal = date();
            lexer.match(' ");
            time(cal);
            lexer.match(' ");
            String tzone = this.lexer.ttoken().toLowerCase();
            if (!"gmt".equals(tzone))
                throw createParseException("Bad Time Zone " + tzone);
            DateHeader retval = new DateHeader();
            retval.setDate(cal);
            return retval;
        } finally {
            if (debug) dbg_leave("DateParser.parse");
        }