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

SDPAnnounceParser

public class SDPAnnounceParser extends ParserCore
Announcement parser.

Fields Summary
protected Lexer
lexer
Current lexer engine.
protected Vector
sdpMessage
The SDP message to be parsed.
Constructors Summary
public SDPAnnounceParser(Vector sdpMessage)
Creates new SDPAnnounceParser.

param
sdpMessage Vector of messages to parse.

        this.sdpMessage = sdpMessage;
	
    
public SDPAnnounceParser(String sdpAnnounce)
Creates a new SDPAnnounceParser.

param
sdpAnnounce message containing the sdp announce message.

	sdpMessage = new Vector();
	int start = 0;
	if (sdpAnnounce == null)
	    return;
	while (start < sdpAnnounce.length()) {
	    int add = 0;
	    int index = sdpAnnounce.indexOf("\n", start);
	    if (index == -1) break;
	    if (sdpAnnounce.charAt(index - 1) == '\r") {
    		index = index - 1;
    		add = 1;
	    }
	    String line = sdpAnnounce.substring(start, index);
	    start = index + 1 + add;
  	    sdpMessage.addElement(line);
	}
	  	
    
Methods Summary
public SessionDescriptionImplparse()
Parses the session description field.

exception
ParseException if a parsing error occurs
return
the parsed session description field

	SessionDescriptionImpl retval = new SessionDescriptionImpl();
	for (int i = 0; i <  sdpMessage.size(); i++) {
	    String field = (String) sdpMessage.elementAt(i);
	    SDPParser sdpParser = ParserFactory.createParser(field);
	    SDPField sdpField = sdpParser.parse();
	    retval.addField(sdpField);
	}
	return retval;