FileDocCategorySizeDatePackage
ProtoVersionFieldParser.javaAPI DocphoneME MR2 API (J2ME)2859Wed May 02 18:00:42 BST 2007gov.nist.javax.sdp.parser

ProtoVersionFieldParser

public class ProtoVersionFieldParser extends SDPParser
Parser for Proto Version.
version
JAIN-SIP-1.1 This code is in the public domain.

Fields Summary
Constructors Summary
public ProtoVersionFieldParser(String protoVersionField)
Creates new ProtoVersionFieldParser.

param
protoVersionField the protocol version field to be parsed

        lexer = new Lexer("charLexer", protoVersionField);
    
protected ProtoVersionFieldParser()
Default constructor.

        super();
    
Methods Summary
public SDPFieldparse()
Perform the protocol version field parsing

return
the parsed protocol version field
exception
ParseException if a parsing error occurs

        return protoVersionField();
    
public ProtoVersionFieldprotoVersionField()
Perform the protocol version field parsing

return
the parsed protocol version field
exception
ParseException if a parsing error occurs

        try {
            lexer.match('v");
            lexer.SPorHT();
            lexer.match('=");
            lexer.SPorHT();

            ProtoVersionField protoVersionField = new ProtoVersionField();
            lexer.match(Lexer.ID);
            Token version = lexer.getNextToken();
            protoVersionField.setProtoVersion(
                               Integer.parseInt(version.getTokenValue()));
            lexer.SPorHT();

            return protoVersionField;
        } catch (NumberFormatException e) {
            throw lexer.createParseException();
        }