org.cyberiantiger.mudclient.net
Class MudConnection

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.cyberiantiger.mudclient.net.MudConnection
All Implemented Interfaces:
java.lang.Runnable

public class MudConnection
extends java.lang.Thread


Field Summary
static int CONNECTED
           
static int CONNECTING
           
static int DISCONNECTED
           
static int DISCONNECTING
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
MudConnection(Display client)
          Create a new MudConnection for the specified MudClient to the destination:port.
 
Method Summary
 void command(java.lang.String text)
           
 boolean connect()
          Connect to the mud.
 boolean disconnect()
          Disconnect from the mud.
 boolean getLocalEcho()
          Get whether or not we should echo user input to the console.
 int getStatus()
          Get the current status of the MudConnection.
 void run()
          Read bytes from the TelnetSocket [if it's connected], parse, and deliver the appropriate ConsoleActions to the MudClient.
 void setParser(Parser parser)
          Set the parser to use to parse output from the mud.
 void setWindowSize(int width, int height)
          Set the window size which is reported to the mud via telnet negotiation.
 
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

DISCONNECTED

public static final int DISCONNECTED
See Also:
Constant Field Values

CONNECTING

public static final int CONNECTING
See Also:
Constant Field Values

CONNECTED

public static final int CONNECTED
See Also:
Constant Field Values

DISCONNECTING

public static final int DISCONNECTING
See Also:
Constant Field Values
Constructor Detail

MudConnection

public MudConnection(Display client)
Create a new MudConnection for the specified MudClient to the destination:port.

Method Detail

getStatus

public int getStatus()
Get the current status of the MudConnection. TODO: Make this watchable, so that listeners can recieve notification when the state changes.


connect

public boolean connect()
Connect to the mud.

Returns:
True on a sucessful connection, false otherwise.

disconnect

public boolean disconnect()
Disconnect from the mud.

Returns:
True on sucessful disconnection.

setWindowSize

public void setWindowSize(int width,
                          int height)
Set the window size which is reported to the mud via telnet negotiation.


getLocalEcho

public boolean getLocalEcho()
Get whether or not we should echo user input to the console.


setParser

public void setParser(Parser parser)
Set the parser to use to parse output from the mud.


command

public void command(java.lang.String text)

run

public void run()
Read bytes from the TelnetSocket [if it's connected], parse, and deliver the appropriate ConsoleActions to the MudClient.



Copyright © 2003 OSJava. All Rights Reserved.