org.haphazard.XML
Class IOHandler

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.haphazard.XML.IOHandler
All Implemented Interfaces:
java.lang.Runnable

public class IOHandler
extends java.lang.Thread


Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
IOHandler(MessageHandler handler)
          Creates a new instance of IOHandler
 
Method Summary
 void add(java.net.Socket socket)
          Adds a socket to be handled.
 void broadcast(Message message)
          Broadcasts the message to all registered sockets.
 void run()
           
 void send(Message message)
          Sends a message through one or all sockets.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IOHandler

public IOHandler(MessageHandler handler)
Creates a new instance of IOHandler

Parameters:
handler - The message handler to be associated with the IO.
Method Detail

add

public void add(java.net.Socket socket)
Adds a socket to be handled.

Parameters:
socket - The socket to receive and send messages on

send

public void send(Message message)
Sends a message through one or all sockets.

Parameters:
message - The message to send

broadcast

public void broadcast(Message message)
Broadcasts the message to all registered sockets. If the message was received from a socket, it is not broadcasted to that socket

Parameters:
message - The message to send

run

public void run()