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

ExpiresParser

public class ExpiresParser extends HeaderParser
Parser for SIP Expires Parser. Converts from SIP Date to the internal storage (Calendar).
version
JAIN-SIP-1.1 This code is in the public domain.

Fields Summary
Constructors Summary
public ExpiresParser()
Default constructor.

public ExpiresParser(String text)
Constructor with initial expires header to be processed.

param
text is the text of the header to parse

        super(text);
    
protected ExpiresParser(Lexer lexer)
Constructor with initial lexer engine.

param
lexer initial lexer engine

        super(lexer);
    
Methods Summary
public Headerparse()
Parses the header.

return
parsed Expires header
exception
ParseException if a parsing error occurs

        ExpiresHeader expires = new ExpiresHeader();
        if (debug) dbg_enter("parse");
        try {
            lexer.match(TokenTypes.EXPIRES);
            lexer.SPorHT();
            lexer.match(':");
            lexer.SPorHT();
            String nextId = lexer.getNextId();
            lexer.match('\n");
            try {
                int delta = Integer.parseInt(nextId);
                expires.setExpires(delta);
                return expires;
            } catch (NumberFormatException ex) {
                throw createParseException("bad integer format");
            }
        } finally {
            if (debug) dbg_leave("parse");
        }