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

RecordRouteParser

public class RecordRouteParser 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
RecordRouteParser()
Default constructor.

 
public RecordRouteParser(String recordRoute)
Constructor with initial record route header.

param
recordRoute message to parse to set

        super(recordRoute);
    
protected RecordRouteParser(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 RecordRoute List Object.

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

        RecordRouteList recordRouteList = new RecordRouteList();
        
        if (debug) dbg_enter("RecordRouteParser.parse");
        
        try {
            this.lexer.match(TokenTypes.RECORD_ROUTE);
            this.lexer.SPorHT();
            this.lexer.match(':");
            this.lexer.SPorHT();
            while (true) {
                RecordRouteHeader recordRoute =  new RecordRouteHeader();
                super.parse(recordRoute);
                recordRouteList.add(recordRoute);
                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 recordRouteList;
        } finally {
            if (debug) dbg_leave("RecordRouteParser.parse");
        }