org.cafesip.sipunit
Class SipMessage

java.lang.Object
  extended by org.cafesip.sipunit.SipMessage
Direct Known Subclasses:
SipRequest, SipResponse

public class SipMessage
extends java.lang.Object

SipMessage represents a SipRequest or a SipResponse. SipMessage provides a uniform way of getting information about a SIP message (request or reponse), such as content length.


Method Summary
 java.lang.Object getContent()
          Obtains the body of the message as an Object.
 int getContentLength()
          Gets the length of the message body.
 int getExpiry()
          Gets the duration after which the message (or content) expires, relative to message receipt.
 javax.sip.message.Message getMessage()
          Obtains the underlying javax.sip.message.Message object.
 byte[] getRawContent()
          Gets the body content of the message as a byte array.
 java.lang.String toString()
          Converts this message object to its String equivalent.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getMessage

public javax.sip.message.Message getMessage()
Obtains the underlying javax.sip.message.Message object. Knowledge of JAIN-SIP API is required.

Returns:
the JAIN-SIP API javax.sip.message.Message object.

getContent

public java.lang.Object getContent()
Obtains the body of the message as an Object.

Returns:
the body of the message or null if a body isn't present.

getContentLength

public int getContentLength()
Gets the length of the message body. The returned length does not include the CRLF separating header fields and body. If no body is present, then zero is returned.

Returns:
the size of the message body in octets.

getRawContent

public byte[] getRawContent()
Gets the body content of the message as a byte array.

Returns:
the body content of the message as a byte array or null if a body isn't present.

getExpiry

public int getExpiry()
Gets the duration after which the message (or content) expires, relative to message receipt. The value of this field is an integral number of seconds (in decimal) between 0 and (2**32)-1

Returns:
the number of seconds that the message (or content) is valid, from the time of receipt.

toString

public java.lang.String toString()
Converts this message object to its String equivalent.

Overrides:
toString in class java.lang.Object
Returns:
a string containing the contents of this message


http://www.cafesip.org