gov.nist.javax.sip.parser
クラス StringMsgParser

java.lang.Object
  上位を拡張 gov.nist.javax.sip.parser.StringMsgParser

public class StringMsgParser
extends java.lang.Object

Parse SIP message and parts of SIP messages such as URI's etc from memory and return a structure. Intended use: UDP message processing. This class is used when you have an entire SIP message or SIPHeader or SIP URL in memory and you want to generate a parsed structure from it. For SIP messages, the payload can be binary or String. If you have a binary payload, use parseSIPMessage(byte[]) else use parseSIPMessage(String) The payload is accessible from the parsed message using the getContent and getContentBytes methods provided by the SIPMessage class. If SDP parsing is enabled using the parseContent method, then the SDP body is also parsed and can be accessed from the message using the getSDPAnnounce method. Currently only eager parsing of the message is supported (i.e. the entire message is parsed in one feld swoop).

バージョン:
JAIN-SIP-1.1 $Revision: 1.9 $ $Date: 2004/02/29 00:46:34 $
作成者:
M. Ranganathan
This code is in the public domain.

コンストラクタの概要
StringMsgParser()
           
StringMsgParser(ParseExceptionListener exhandler)
          Constructor (given a parse exception handler).
 
メソッドの概要
 java.lang.String getCurrentHeader()
          Get the current header.
 int getCurrentLineNumber()
          Get the current line number.
 AddressImpl parseAddress(java.lang.String address)
          Parse an address (nameaddr or address spec) and return and address structure.
 Host parseHost(java.lang.String host)
          Parse a host name and return a parsed structure.
 HostPort parseHostPort(java.lang.String hostport)
          Parse a host:port and return a parsed structure.
 SIPHeader parseSIPHeader(java.lang.String header)
          Parse an individual SIP message header from a string.
 SIPMessage parseSIPMessage(byte[] msgBuffer)
          Parse a buffer containing a single SIP Message where the body is an array of un-interpreted bytes.
 SIPMessage parseSIPMessage(java.lang.String sipMessages)
          Parse a buffer containing one or more SIP Messages and return an array of SIPMessage parsed structures.
 RequestLine parseSIPRequestLine(java.lang.String requestLine)
          Parse the SIP Request Line
 StatusLine parseSIPStatusLine(java.lang.String statusLine)
          Parse the SIP Response message status line
 SipUri parseSIPUrl(java.lang.String url)
          Parse a SIP url from a string and return a URI structure for it.
 TelephoneNumber parseTelephoneNumber(java.lang.String telephone_number)
          Parse a telephone number return a parsed structure.
 GenericURI parseUrl(java.lang.String url)
          Parse a uri from a string and return a URI structure for it.
 void setParseExceptionListener(ParseExceptionListener pexhandler)
          add a handler for header parsing errors.
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

StringMsgParser

public StringMsgParser()
導入されたバージョン:
v0.9

StringMsgParser

public StringMsgParser(ParseExceptionListener exhandler)
Constructor (given a parse exception handler).

パラメータ:
exhandler - is the parse exception listener for the message parser.
導入されたバージョン:
1.0
メソッドの詳細

setParseExceptionListener

public void setParseExceptionListener(ParseExceptionListener pexhandler)
add a handler for header parsing errors.

パラメータ:
pexhandler - is a class that implements the ParseExceptionListener interface.

parseSIPMessage

public SIPMessage parseSIPMessage(byte[] msgBuffer)
                           throws java.text.ParseException
Parse a buffer containing a single SIP Message where the body is an array of un-interpreted bytes. This is intended for parsing the message from a memory buffer when the buffer. Incorporates a bug fix for a bug that was noted by Will Sullin of Callcast

パラメータ:
msgBuffer - a byte buffer containing the messages to be parsed. This can consist of multiple SIP Messages concatenated together.
戻り値:
a SIPMessage[] structure (request or response) containing the parsed SIP message.
例外:
SIPIllegalMessageException - is thrown when an illegal message has been encountered (and the rest of the buffer is discarded).
java.text.ParseException
関連項目:
ParseExceptionListener

parseSIPMessage

public SIPMessage parseSIPMessage(java.lang.String sipMessages)
                           throws java.text.ParseException
Parse a buffer containing one or more SIP Messages and return an array of SIPMessage parsed structures.

パラメータ:
sipMessages - a String containing the messages to be parsed. This can consist of multiple SIP Messages concatenated together.
戻り値:
a SIPMessage structure (request or response) containing the parsed SIP message.
例外:
SIPIllegalMessageException - is thrown when an illegal message has been encountered (and the rest of the buffer is discarded).
java.text.ParseException
関連項目:
ParseExceptionListener

parseAddress

public AddressImpl parseAddress(java.lang.String address)
                         throws java.text.ParseException
Parse an address (nameaddr or address spec) and return and address structure.

パラメータ:
address - is a String containing the address to be parsed.
戻り値:
a parsed address structure.
例外:
java.text.ParseException - when the address is badly formatted.
導入されたバージョン:
v1.0

parseHostPort

public HostPort parseHostPort(java.lang.String hostport)
                       throws java.text.ParseException
Parse a host:port and return a parsed structure.

パラメータ:
hostport - is a String containing the host:port to be parsed
戻り値:
a parsed address structure.
例外:
throws - a ParseException when the address is badly formatted.
java.text.ParseException
導入されたバージョン:
v1.0

parseHost

public Host parseHost(java.lang.String host)
               throws java.text.ParseException
Parse a host name and return a parsed structure.

パラメータ:
host - is a String containing the host name to be parsed
戻り値:
a parsed address structure.
例外:
throws - a ParseException when the hostname is badly formatted.
java.text.ParseException
導入されたバージョン:
v1.0

parseTelephoneNumber

public TelephoneNumber parseTelephoneNumber(java.lang.String telephone_number)
                                     throws java.text.ParseException
Parse a telephone number return a parsed structure.

パラメータ:
telephone_number - is a String containing the telephone # to be parsed
戻り値:
a parsed address structure.
例外:
throws - a ParseException when the address is badly formatted.
java.text.ParseException
導入されたバージョン:
v1.0

parseSIPUrl

public SipUri parseSIPUrl(java.lang.String url)
                   throws java.text.ParseException
Parse a SIP url from a string and return a URI structure for it.

パラメータ:
url - a String containing the URI structure to be parsed.
戻り値:
A parsed URI structure
例外:
java.text.ParseException - if there was an error parsing the message.

parseUrl

public GenericURI parseUrl(java.lang.String url)
                    throws java.text.ParseException
Parse a uri from a string and return a URI structure for it.

パラメータ:
url - a String containing the URI structure to be parsed.
戻り値:
A parsed URI structure
例外:
java.text.ParseException - if there was an error parsing the message.

parseSIPHeader

public SIPHeader parseSIPHeader(java.lang.String header)
                         throws java.text.ParseException
Parse an individual SIP message header from a string.

パラメータ:
header - String containing the SIP header.
戻り値:
a SIPHeader structure.
例外:
java.text.ParseException - if there was an error parsing the message.

parseSIPRequestLine

public RequestLine parseSIPRequestLine(java.lang.String requestLine)
                                throws java.text.ParseException
Parse the SIP Request Line

パラメータ:
requestLine - a String containing the request line to be parsed.
戻り値:
a RequestLine structure that has the parsed RequestLine
例外:
java.text.ParseException - if there was an error parsing the requestLine.

parseSIPStatusLine

public StatusLine parseSIPStatusLine(java.lang.String statusLine)
                              throws java.text.ParseException
Parse the SIP Response message status line

パラメータ:
statusLine - a String containing the Status line to be parsed.
戻り値:
StatusLine class corresponding to message
例外:
java.text.ParseException - if there was an error parsing
関連項目:
StatusLine

getCurrentHeader

public java.lang.String getCurrentHeader()
Get the current header.


getCurrentLineNumber

public int getCurrentLineNumber()
Get the current line number.