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

RouteParser

public class RouteParser extends AddressParametersParser
Parser for a list of route headers.
version
JAIN-SIP-1.1 This code is in the public domain.
version
1.0

Fields Summary
Constructors Summary
RouteParser()
Default constructor.

public RouteParser(String route)
Constructor with initial routeheader field.

param
route message to parse to set

        super(route);
    
protected RouteParser(Lexer lexer)
Constructor with initial lexer engine.

param
lexer initial lexer engine

        super(lexer);
    
Methods Summary
public Headerparse()
Parses the String message and generate the Route List Object.

return
Header the Route List object
throws
ParseException if errors occur during the parsing

        RouteList routeList = new RouteList();
        if (debug) dbg_enter("parse");
        
        try {
            this.lexer.match(TokenTypes.ROUTE);
            this.lexer.SPorHT();
            this.lexer.match(':");
            this.lexer.SPorHT();
            while (true) {
                RouteHeader route = new RouteHeader();
                super.parse(route);
                routeList.add(route);
                this.lexer.SPorHT();
                if (lexer.lookAhead(0) == ',") {
                    this.lexer.match(',");
                    this.lexer.SPorHT();
                } else if (lexer.lookAhead(0) == '\n") break;
                else throw createParseException("unexpected char");
            }
            return routeList;
        } finally {
            if (debug) dbg_leave("parse");
        }