org.media.mn8.protocol.jabber
Class JabberStream

java.lang.Object
  |
  +--org.media.mn8.protocol.jabber.JabberStream
All Implemented Interfaces:
Runnable, XMLEventListener

public class JabberStream
extends Object
implements XMLEventListener, Runnable

The stream to a jabber server.


Constructor Summary
JabberStream(ConnectorInterface connectorInterface)
          Constructor.
JabberStream(ConnectorInterface connectorInterface, JabberListener theListener)
          Constructor.
JabberStream(ConnectorInterface connectorInterface, JabberListener theListener, boolean connect)
          Constructor.
 
Method Summary
 void close()
          Method to close the connection to the server and tell the listener that the connection has been terminated.
 void open(ConnectorInterface connectorInterface)
          Method to open the connection to the server.
 void plaintextEncountered(String text)
          Method called when some plain text is encountered in the XML stream comming from the server.
 void run()
          The threads run method.
 void send(byte[] data)
          Method of sending data to the server.
 void send(JabberDataBlock block)
          Method of sending a Jabber datablock to the server.
 void send(String data)
          Method of sending data to the server.
 void setJabberListener(JabberListener listener)
          Set the listener to this stream.
 void tagEnded(String name)
          The method called when a tag is ended in the stream comming from the server.
 void tagStarted(String name, Hashtable attributes)
          Method called when an XML tag is started in the stream comming from the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JabberStream

public JabberStream(ConnectorInterface connectorInterface)
             throws IOException
Constructor. Connects to the server and sends the jabber welcome message.

Parameters:
connectorInterface - The connector which establishes the socket for the connection

JabberStream

public JabberStream(ConnectorInterface connectorInterface,
                    JabberListener theListener)
             throws IOException
Constructor. Connects to the server and sends the jabber welcome message.

Parameters:
connectorInterface - The connector which establishes the socket for the connection
theListener - The listener object to send all messages arriving on this stream to

JabberStream

public JabberStream(ConnectorInterface connectorInterface,
                    JabberListener theListener,
                    boolean connect)
             throws IOException
Constructor. Connects to the server and sends the jabber welcome message.

Parameters:
connectorInterface - The connector which establishes the socket for the connection
theListener - The listener object to send all messages arriving on this stream to
connect - Flag to say whether or not to connect during object instanciation (true = yes, false = no).
Method Detail

open

public void open(ConnectorInterface connectorInterface)
          throws IOException
Method to open the connection to the server.

Parameters:
connectorInterface - The connector which establishes the socket for the connection
IOException

run

public void run()
The threads run method. Handles the parsing of incomming data in its own thread.

Specified by:
run in interface Runnable

close

public void close()
Method to close the connection to the server and tell the listener that the connection has been terminated.


send

public void send(byte[] data)
          throws IOException
Method of sending data to the server.

Parameters:
data - The data to send.
IOException

send

public void send(String data)
          throws IOException
Method of sending data to the server.

IOException

send

public void send(JabberDataBlock block)
          throws IOException
Method of sending a Jabber datablock to the server.

Parameters:
block - The data block to send to the server.
IOException

setJabberListener

public void setJabberListener(JabberListener listener)
Set the listener to this stream.


tagStarted

public void tagStarted(String name,
                       Hashtable attributes)
Method called when an XML tag is started in the stream comming from the server.

Specified by:
tagStarted in interface XMLEventListener
Parameters:
name - Tag name.
attributes - The tags attributes.

plaintextEncountered

public void plaintextEncountered(String text)
Method called when some plain text is encountered in the XML stream comming from the server.

Specified by:
plaintextEncountered in interface XMLEventListener
Parameters:
text - The plain text in question

tagEnded

public void tagEnded(String name)
The method called when a tag is ended in the stream comming from the server.

Specified by:
tagEnded in interface XMLEventListener
Parameters:
name - The name of the tag that has just ended.


"Copyright © 2000-2002 Internet Multicasting Services, media.org & noLimits Technologies. All Rights Reserved."