android.gov.nist.javax.sip.parser.extensions.ReferencesParser Maven / Gradle / Ivy
package android.gov.nist.javax.sip.parser.extensions;
import android.gov.nist.core.Token;
import android.gov.nist.javax.sip.header.Reason;
import android.gov.nist.javax.sip.header.ReasonList;
import android.gov.nist.javax.sip.header.SIPHeader;
import android.gov.nist.javax.sip.header.extensions.References;
import android.gov.nist.javax.sip.parser.Lexer;
import android.gov.nist.javax.sip.parser.ParametersParser;
import android.gov.nist.javax.sip.parser.TokenTypes;
import java.text.ParseException;
public class ReferencesParser extends ParametersParser {
/**
* Creates a new instance of ReferencesParser
* @param references the header to parse
*/
public ReferencesParser(String references) {
super(references);
}
/**
* Constructor
* @param lexer the lexer to use to parse the header
*/
protected ReferencesParser(Lexer lexer) {
super(lexer);
}
/**
* parse the String message
* @return SIPHeader (ReasonParserList object)
* @throws SIPParseException if the message does not respect the spec.
*/
public SIPHeader parse() throws ParseException {
if (debug)
dbg_enter("ReasonParser.parse");
try {
headerName(TokenTypes.REFERENCES);
References references= new References();
this.lexer.SPorHT();
String callId = lexer.byteStringNoSemicolon();
references.setCallId(callId);
super.parse(references);
return references;
} finally {
if (debug)
dbg_leave("ReferencesParser.parse");
}
}
}