f00f.net.irc.martyr
Class InputHandler

java.lang.Object
  extended by java.lang.Thread
      extended by f00f.net.irc.martyr.InputHandler
All Implemented Interfaces:
java.lang.Runnable

public class InputHandler
extends java.lang.Thread

A simple class to help manage input from the stream.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
InputHandler(java.io.BufferedReader reader, IRCConnection connection, java.lang.Object eventMonitor)
           
 
Method Summary
 java.lang.String getMessage()
          Gets the message at the top of the message queue and removes it from the message queue.
 boolean pendingMessages()
           
 void run()
          Waits for input from the server.
 void signalShutdown()
          Set the shutdown flag, so that after next read, or on any error, the thread will just exit.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InputHandler

public InputHandler(java.io.BufferedReader reader,
                    IRCConnection connection,
                    java.lang.Object eventMonitor)
Method Detail

signalShutdown

public void signalShutdown()
Set the shutdown flag, so that after next read, or on any error, the thread will just exit.


pendingMessages

public boolean pendingMessages()
Returns:
true if there are messages waiting to be processed.

getMessage

public java.lang.String getMessage()
Gets the message at the top of the message queue and removes it from the message queue.

Returns:
Message from top of list.

run

public void run()
Waits for input from the server. When input arrives, it is added to a queue and eventMonitor.notifyAll() is called.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Thread


Copyright © 2000-2007 Ben Damm, Daniel Henninger, et al.