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

Package | Class | Use | Tree | Deprecated | Index | Help
| PircBot Java IRC Bot
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jibble.pircbot
Class InputThread

    java.lang.Object
      |
      +--java.lang.Thread
            |
            +--org.jibble.pircbot.InputThread

All Implemented Interfaces:
  Runnable

public class InputThread
extends Thread

A Thread which reads lines from the IRC server. It then passes these lines to the PircBot without changing them. This running Thread also detects disconnection from the server and is thus used by the OutputThread to send lines to the server.

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

Field Summary
`static int` | `MAX_LINE_LENGTH`

Fields inherited from class java.lang.Thread
`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

Constructor Summary
`protected` | `InputThread(PircBot bot, Socket socket, BufferedReader breader, BufferedWriter bwriter)` The InputThread reads lines from the IRC server and allows the PircBot to handle them.

Method Summary
`boolean` | `isConnected()` Returns true if this InputThread is connected to an IRC server.
`void` | `run()` Called to start this Thread reading lines from the IRC server.
`void` | `sendRawLine(String line)` Sends a raw line to the IRC server as soon as possible, bypassing the outgoing message queue.

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`

Field Detail

### MAX_LINE_LENGTH

    public static final int MAX_LINE_LENGTH

See Also:
  Constant Field Values

Constructor Detail

### InputThread

    protected InputThread(PircBot bot,
                          Socket socket,
                          BufferedReader breader,
                          BufferedWriter bwriter)

  The InputThread reads lines from the IRC server and allows the PircBot to handle them.

Parameters:
  `bot` - An instance of the underlying PircBot.
  `breader` - The BufferedReader that reads lines from the server.
  `bwriter` - The BufferedWriter that sends lines to the server.

Method Detail

### sendRawLine

    public void sendRawLine(String line)

  Sends a raw line to the IRC server as soon as possible, bypassing the outgoing message queue.

  Parameters:
    `line` - The raw line to send to the IRC server.

### isConnected

    public boolean isConnected()

  Returns true if this InputThread is connected to an IRC server. The result of this method should only act as a rough guide, as the result may not be valid by the time you act upon it.

  Returns:
    True if still connected.

### run

    public void run()

  Called to start this Thread reading lines from the IRC server. When a line is read, this method calls the handleLine method in the PircBot, which may subsequently call an 'onXxx' method in the PircBot subclass. If any subclass of Throwable (i.e. any Exception or Error) is thrown by your method, then this method will print the stack trace to the standard output. It is probable that the PircBot may still be functioning normally after such a problem, but the existance of any uncaught exceptions in your code is something you should really fix.

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

Package | Class | Use | Tree | Deprecated | Index | Help
| PircBot Java IRC Bot
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD