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

EventParser

public class EventParser extends ParametersParser
Parser for Event header.
version
JAIN-SIP-1.1 This code is in the public domain.
version
1.0

Fields Summary
Constructors Summary
EventParser()
Default constructor.

public EventParser(String event)
Creates a new instance of EventParser.

param
event the header to parse

        super(event);
    
protected EventParser(Lexer lexer)
Constructor with initial lexer engine.

param
lexer initial lexer engine

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

return
Header (Event object)
throws
SIPParseException if the message does not respect the spec.

        
        if (debug) dbg_enter("EventParser.parse");
        
        try {
            headerName(TokenTypes.EVENT);
            this.lexer.SPorHT();
            
            EventHeader event = new EventHeader();
            this.lexer.match(TokenTypes.ID);
            Token token = lexer.getNextToken();
            String value = token.getTokenValue();
            
            event.setEventType(value);
            super.parse(event);
            
            this.lexer.SPorHT();
            this.lexer.match('\n");
            
            return event;
            
        } catch (ParseException ex) {
            throw createParseException(ex.getMessage());
        } finally {
            if (debug) dbg_leave("EventParser.parse");
        }