Google

OutputThread (PircBot 1.0.3 - Paul's Java IRC Bot Framework)
PircBot Java IRC Bot

org.jibble.pircbot
Class OutputThread


java.lang.Object

  |

  +--java.lang.Thread

        |

        +--org.jibble.pircbot.OutputThread

All Implemented Interfaces:
Runnable

public class OutputThread
extends Thread

A Thread which is responsible for sending messages to the IRC server. Messages are obtained from the outgoing message queue and sent immediately if possible. If there is a flood of messages, then to avoid getting kicked from a channel, we put a small delay between each one.

Version:
1.0.3 (Build time: Sat Jan 18 23:29:54 2003)
Author:
Paul James Mutton, http://www.jibble.org/

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected OutputThread(PircBot bot, Queue outQueue)
          Constructs an OutputThread for the underlying PircBot.
 
Method Summary
 void run()
          This method starts the Thread consuming from the outgoing message Queue and sending lines to the server.
static void sendRawLine(PircBot bot, BufferedWriter writer, String line)
          A static method to write a line to a BufferedWriter and then pass the line to the log method of the supplied PircBot instance.
 
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

OutputThread


protected OutputThread(PircBot bot,
                       Queue outQueue)
Constructs an OutputThread for the underlying PircBot. All messages sent to the IRC server are sent by this OutputThread to avoid hammering the server. Messages are sent immediately if possible. If there are multiple messages queued, then there is a delay imposed.

Parameters:
bot - The underlying PircBot instance.
outQueue - The Queue from which we will obtain our messages.
Method Detail

sendRawLine


public static void sendRawLine(PircBot bot,
                               BufferedWriter writer,
                               String line)
A static method to write a line to a BufferedWriter and then pass the line to the log method of the supplied PircBot instance.

Parameters:
bot - The underlying PircBot instance.
writer - The BufferedWriter to write to.
line - The line to be written. "\r\n" is appended to the end.

run


public void run()
This method starts the Thread consuming from the outgoing message Queue and sending lines to the server.

Specified by:
run in interface Runnable
Overrides:
run in class Thread

PircBot Java IRC Bot