pawn.messages
Class PresenceResponse

java.lang.Object
  |
  +--pawn.messages.PresenceResponseMessage
        |
        +--pawn.messages.PresenceResponse

public class PresenceResponse
extends PresenceResponseMessage

An implementation of the PresenceResponseMessage abstract class. This class is responsible for parsing and formatting the XML document used to define a response to a query for presence information.


Constructor Summary
PresenceResponse(java.io.InputStream stream)
          Creates a new Presence Response Message by parsing the given stream.
 
Method Summary
 net.jxta.document.Document getDocument(net.jxta.document.MimeMediaType asMimeType)
          Returns a Document object containing the response's document tree.
 void readDocument(net.jxta.document.TextElement document)
          Parses the given document tree for the presence response message.
 java.lang.String toString()
          Returns an XML String representation of the response.
 
Methods inherited from class pawn.messages.PresenceResponseMessage
getPresenceAdvertisement, setPresenceAdvertisement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PresenceResponse

public PresenceResponse(java.io.InputStream stream)
                 throws java.io.IOException,
                        java.lang.IllegalArgumentException
Creates a new Presence Response Message by parsing the given stream.

Parameters:
stream - the InputStream source of the response data.
Throws:
java.io.IOException - if the response can't be parsed from the stream.
java.lang.IllegalArgumentException - thrown if the data does not contain a Presence Response Message.
Method Detail

getDocument

public net.jxta.document.Document getDocument(net.jxta.document.MimeMediaType asMimeType)
                                       throws java.lang.IllegalArgumentException
Returns a Document object containing the response's document tree.

Specified by:
getDocument in class PresenceResponseMessage
Parameters:
asMimeType - the desired MIME type for the response rendering.
Returns:
the Document containing the response's document object tree.
Throws:
java.lang.IllegalArgumentException - thrown if the presence advertisement is null.

readDocument

public void readDocument(net.jxta.document.TextElement document)
                  throws java.lang.IllegalArgumentException
Parses the given document tree for the presence response message.

Parameters:
document - the object containing the presence response data.
Throws:
java.lang.IllegalArgumentException - if the document is not a presence response, as expected.

toString

public java.lang.String toString()
Returns an XML String representation of the response.

Overrides:
toString in class java.lang.Object
Returns:
the XML String representing this response.