public class StringMsgParser extends Object implements MessageParser
Modifier and Type | Field and Description |
---|---|
protected static boolean |
computeContentLengthFromMessage |
Constructor and Description |
---|
StringMsgParser() |
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args)
Test code.
|
AddressImpl |
parseAddress(String address)
Parse an address (nameaddr or address spec) and return and address
structure.
|
Host |
parseHost(String host)
Parse a host name and return a parsed structure.
|
static SIPHeader |
parseSIPHeader(String header)
Parse an individual SIP message header from a string.
|
SIPMessage |
parseSIPMessage(byte[] msgBuffer,
boolean readBody,
boolean strict,
ParseExceptionListener parseExceptionListener)
Parse a buffer containing a single SIP Message where the body is an array
of un-interpreted bytes.
|
RequestLine |
parseSIPRequestLine(String requestLine)
Parse the SIP Request Line
|
StatusLine |
parseSIPStatusLine(String statusLine)
Parse the SIP Response message status line
|
SipUri |
parseSIPUrl(String url)
Parse a SIP url from a string and return a URI structure for it.
|
TelephoneNumber |
parseTelephoneNumber(String telephone_number)
Parse a telephone number return a parsed structure.
|
GenericURI |
parseUrl(String url)
Parse a uri from a string and return a URI structure for it.
|
protected SIPMessage |
processFirstLine(String firstLine,
ParseExceptionListener parseExceptionListener,
byte[] msgBuffer) |
protected void |
processHeader(String header,
SIPMessage message,
ParseExceptionListener parseExceptionListener,
byte[] rawMessage) |
static void |
setComputeContentLengthFromMessage(boolean computeContentLengthFromMessage) |
protected static String |
trimEndOfLine(String line) |
protected static boolean computeContentLengthFromMessage
public SIPMessage parseSIPMessage(byte[] msgBuffer, boolean readBody, boolean strict, ParseExceptionListener parseExceptionListener) throws ParseException
parseSIPMessage
in interface MessageParser
msgBuffer
- a byte buffer containing the messages to be parsed. This can
consist of multiple SIP Messages concatenated together.readBody
- If the content body should be read or notparseExceptionListener
- Callback if an exception occurs during the parsing to notify back the stackParseException
- is thrown when an illegal message has been encountered
(and the rest of the buffer is discarded).ParseExceptionListener
protected SIPMessage processFirstLine(String firstLine, ParseExceptionListener parseExceptionListener, byte[] msgBuffer) throws ParseException
ParseException
protected void processHeader(String header, SIPMessage message, ParseExceptionListener parseExceptionListener, byte[] rawMessage) throws ParseException
ParseException
public AddressImpl parseAddress(String address) throws ParseException
address
- is a String containing the address to be parsed.ParseException
- when the address is badly formatted.public Host parseHost(String host) throws ParseException
host
- is a String containing the host name to be parsedParseException
- a ParseException when the hostname is badly formatted.public TelephoneNumber parseTelephoneNumber(String telephone_number) throws ParseException
telephone_number
- is a String containing the telephone # to be parsedParseException
- a ParseException when the address is badly formatted.public SipUri parseSIPUrl(String url) throws ParseException
url
- a String containing the URI structure to be parsed.ParseException
- if there was an error parsing the message.public GenericURI parseUrl(String url) throws ParseException
url
- a String containing the URI structure to be parsed.ParseException
- if there was an error parsing the message.public static SIPHeader parseSIPHeader(String header) throws ParseException
header
- String containing the SIP header.ParseException
- if there was an error parsing the message.public RequestLine parseSIPRequestLine(String requestLine) throws ParseException
requestLine
- a String containing the request line to be parsed.ParseException
- if there was an error parsing the requestLine.public StatusLine parseSIPStatusLine(String statusLine) throws ParseException
statusLine
- a String containing the Status line to be parsed.ParseException
- if there was an error parsingStatusLine
public static void setComputeContentLengthFromMessage(boolean computeContentLengthFromMessage)
public static void main(String[] args) throws ParseException
ParseException
Copyright © 2016. All Rights Reserved.