Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.commons.net.telnet
Class Telnet  view Telnet download Telnet.java

java.lang.Object
  extended byorg.apache.commons.net.SocketClient
      extended byorg.apache.commons.net.telnet.Telnet
Direct Known Subclasses:
TelnetClient

class Telnet
extends org.apache.commons.net.SocketClient


Field Summary
private  TelnetNotificationHandler __notifhand
          The notification handler
(package private) static byte[] _COMMAND_AYT
          AYT sequence
(package private) static byte[] _COMMAND_DO
           
(package private) static byte[] _COMMAND_DONT
           
(package private) static byte[] _COMMAND_IS
          Is sequence (for subnegotiation)
(package private) static byte[] _COMMAND_SB
           
(package private) static byte[] _COMMAND_SE
           
(package private) static byte[] _COMMAND_WILL
           
(package private) static byte[] _COMMAND_WONT
           
(package private) static int _DO_MASK
           
(package private)  int[] _doResponse
           
(package private)  int[] _options
           
(package private) static int _REQUESTED_DO_MASK
           
(package private) static int _REQUESTED_WILL_MASK
           
(package private) static int _WILL_MASK
           
(package private)  int[] _willResponse
           
private  boolean aytFlag
          flag for AYT
private  java.lang.Object aytMonitor
          monitor to wait for AYT
(package private) static boolean debug
           
(package private) static boolean debugoptions
           
(package private) static int DEFAULT_PORT
           
private  TelnetOptionHandler[] optionHandlers
          Array of option handlers
private  java.io.OutputStream spyStream
          The stream on which to spy
protected static int TERMINAL_TYPE
          Terminal type option
protected static int TERMINAL_TYPE_IS
          Is (for subnegotiation)
protected static int TERMINAL_TYPE_SEND
          Send (for subnegotiation)
private  java.lang.String terminalType
          Terminal type
 
Fields inherited from class org.apache.commons.net.SocketClient
_defaultPort_, _input_, _isConnected_, _output_, _socket_, _socketFactory_, _timeout_, NETASCII_EOL
 
Constructor Summary
(package private) Telnet()
          Empty Constructor
(package private) Telnet(java.lang.String termtype)
          This constructor lets you specify the terminal type.
 
Method Summary
protected  void _connectAction_()
          Called upon connection.
(package private)  void _processAYTResponse()
          Processes the response of an AYT
(package private)  void _processDo(int option)
          Processes a DO request.
(package private)  void _processDont(int option)
          Processes a DONT request.
(package private)  void _processSuboption(int[] suboption, int suboptionLength)
          Processes a suboption negotiation.
(package private)  void _processWill(int option)
          Processes a WILL request.
(package private)  void _processWont(int option)
          Processes a WONT request.
(package private)  void _registerSpyStream(java.io.OutputStream spystream)
          Registers an OutputStream for spying what's going on in the Telnet session.
(package private)  void _requestDo(int option)
          Requests a DO.
(package private)  void _requestDont(int option)
          Requests a DONT.
(package private)  boolean _requestedDo(int option)
          Looks for the state of the option.
(package private)  boolean _requestedDont(int option)
          Looks for the state of the option.
(package private)  boolean _requestedWill(int option)
          Looks for the state of the option.
(package private)  boolean _requestedWont(int option)
          Looks for the state of the option.
(package private)  void _requestWill(int option)
          Requests a WILL.
(package private)  void _requestWont(int option)
          Requests a WONT.
(package private)  boolean _sendAYT(long timeout)
          Sends an Are You There sequence and waits for the result.
(package private)  void _sendByte(int b)
          Sends a byte.
(package private)  void _sendDo(int option)
          Sends a DO.
(package private)  void _sendDont(int option)
          Sends a DONT.
(package private)  void _sendSubnegotiation(int[] subn)
          Manages subnegotiation for Terminal Type.
(package private)  void _sendTerminalType()
          Sends terminal type information.
(package private)  void _sendWill(int option)
          Sends a WILL.
(package private)  void _sendWont(int option)
          Sends a WONT.
(package private)  void _setDo(int option)
          Sets the state of the option.
(package private)  void _setDont(int option)
          Sets the state of the option.
(package private)  void _setWantDo(int option)
          Sets the state of the option.
(package private)  void _setWantDont(int option)
          Sets the state of the option.
(package private)  void _setWantWill(int option)
          Sets the state of the option.
(package private)  void _setWantWont(int option)
          Sets the state of the option.
(package private)  void _setWill(int option)
          Sets the state of the option.
(package private)  void _setWont(int option)
          Sets the state of the option.
(package private)  void _spyRead(int ch)
          Sends a read char on the spy stream.
(package private)  void _spyWrite(int ch)
          Sends a written char on the spy stream.
(package private)  boolean _stateIsDo(int option)
          Looks for the state of the option.
(package private)  boolean _stateIsDont(int option)
          Looks for the state of the option.
(package private)  boolean _stateIsWill(int option)
          Looks for the state of the option.
(package private)  boolean _stateIsWont(int option)
          Looks for the state of the option.
(package private)  void _stopSpyStream()
          Stops spying this Telnet.
(package private)  void addOptionHandler(TelnetOptionHandler opthand)
          Registers a new TelnetOptionHandler for this telnet to use.
(package private)  void deleteOptionHandler(int optcode)
          Unregisters a TelnetOptionHandler.
 void registerNotifHandler(TelnetNotificationHandler notifhand)
          Registers a notification handler to which will be sent notifications of received telnet option negotiation commands.
 void unregisterNotifHandler()
          Unregisters the current notification handler.
 
Methods inherited from class org.apache.commons.net.SocketClient
connect, connect, connect, connect, connect, connect, disconnect, getDefaultPort, getDefaultTimeout, getLocalAddress, getLocalPort, getRemoteAddress, getRemotePort, getSoLinger, getSoTimeout, getTcpNoDelay, isConnected, setDefaultPort, setDefaultTimeout, setSocketFactory, setSoLinger, setSoTimeout, setTcpNoDelay, verifyRemote
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

static final boolean debug
See Also:
Constant Field Values

debugoptions

static final boolean debugoptions
See Also:
Constant Field Values

_COMMAND_DO

static final byte[] _COMMAND_DO

_COMMAND_DONT

static final byte[] _COMMAND_DONT

_COMMAND_WILL

static final byte[] _COMMAND_WILL

_COMMAND_WONT

static final byte[] _COMMAND_WONT

_COMMAND_SB

static final byte[] _COMMAND_SB

_COMMAND_SE

static final byte[] _COMMAND_SE

_WILL_MASK

static final int _WILL_MASK
See Also:
Constant Field Values

_DO_MASK

static final int _DO_MASK
See Also:
Constant Field Values

_REQUESTED_WILL_MASK

static final int _REQUESTED_WILL_MASK
See Also:
Constant Field Values

_REQUESTED_DO_MASK

static final int _REQUESTED_DO_MASK
See Also:
Constant Field Values

DEFAULT_PORT

static final int DEFAULT_PORT
See Also:
Constant Field Values

_doResponse

int[] _doResponse

_willResponse

int[] _willResponse

_options

int[] _options

TERMINAL_TYPE

protected static final int TERMINAL_TYPE
Terminal type option

See Also:
Constant Field Values

TERMINAL_TYPE_SEND

protected static final int TERMINAL_TYPE_SEND
Send (for subnegotiation)

See Also:
Constant Field Values

TERMINAL_TYPE_IS

protected static final int TERMINAL_TYPE_IS
Is (for subnegotiation)

See Also:
Constant Field Values

_COMMAND_IS

static final byte[] _COMMAND_IS
Is sequence (for subnegotiation)


terminalType

private java.lang.String terminalType
Terminal type


optionHandlers

private TelnetOptionHandler[] optionHandlers
Array of option handlers


_COMMAND_AYT

static final byte[] _COMMAND_AYT
AYT sequence


aytMonitor

private java.lang.Object aytMonitor
monitor to wait for AYT


aytFlag

private boolean aytFlag
flag for AYT


spyStream

private java.io.OutputStream spyStream
The stream on which to spy


__notifhand

private TelnetNotificationHandler __notifhand
The notification handler

Constructor Detail

Telnet

Telnet()
Empty Constructor


Telnet

Telnet(java.lang.String termtype)
This constructor lets you specify the terminal type.

Method Detail

_stateIsWill

boolean _stateIsWill(int option)
Looks for the state of the option.


_stateIsWont

boolean _stateIsWont(int option)
Looks for the state of the option.


_stateIsDo

boolean _stateIsDo(int option)
Looks for the state of the option.


_stateIsDont

boolean _stateIsDont(int option)
Looks for the state of the option.


_requestedWill

boolean _requestedWill(int option)
Looks for the state of the option.


_requestedWont

boolean _requestedWont(int option)
Looks for the state of the option.


_requestedDo

boolean _requestedDo(int option)
Looks for the state of the option.


_requestedDont

boolean _requestedDont(int option)
Looks for the state of the option.


_setWill

void _setWill(int option)
Sets the state of the option.


_setDo

void _setDo(int option)
Sets the state of the option.


_setWantWill

void _setWantWill(int option)
Sets the state of the option.


_setWantDo

void _setWantDo(int option)
Sets the state of the option.


_setWont

void _setWont(int option)
Sets the state of the option.


_setDont

void _setDont(int option)
Sets the state of the option.


_setWantWont

void _setWantWont(int option)
Sets the state of the option.


_setWantDont

void _setWantDont(int option)
Sets the state of the option.


_processDo

void _processDo(int option)
          throws java.io.IOException
Processes a DO request.


_processDont

void _processDont(int option)
            throws java.io.IOException
Processes a DONT request.


_processWill

void _processWill(int option)
            throws java.io.IOException
Processes a WILL request.


_processWont

void _processWont(int option)
            throws java.io.IOException
Processes a WONT request.


_processSuboption

void _processSuboption(int[] suboption,
                       int suboptionLength)
                 throws java.io.IOException
Processes a suboption negotiation.


_sendTerminalType

final void _sendTerminalType()
                      throws java.io.IOException
Sends terminal type information.


_sendSubnegotiation

final void _sendSubnegotiation(int[] subn)
                        throws java.io.IOException
Manages subnegotiation for Terminal Type.


_processAYTResponse

final void _processAYTResponse()
Processes the response of an AYT


_connectAction_

protected void _connectAction_()
                        throws java.io.IOException
Called upon connection.


_sendDo

final void _sendDo(int option)
            throws java.io.IOException
Sends a DO.


_requestDo

final void _requestDo(int option)
               throws java.io.IOException
Requests a DO.


_sendDont

final void _sendDont(int option)
              throws java.io.IOException
Sends a DONT.


_requestDont

final void _requestDont(int option)
                 throws java.io.IOException
Requests a DONT.


_sendWill

final void _sendWill(int option)
              throws java.io.IOException
Sends a WILL.


_requestWill

final void _requestWill(int option)
                 throws java.io.IOException
Requests a WILL.


_sendWont

final void _sendWont(int option)
              throws java.io.IOException
Sends a WONT.


_requestWont

final void _requestWont(int option)
                 throws java.io.IOException
Requests a WONT.


_sendByte

final void _sendByte(int b)
              throws java.io.IOException
Sends a byte.


_sendAYT

final boolean _sendAYT(long timeout)
                throws java.io.IOException,
                       java.lang.IllegalArgumentException,
                       java.lang.InterruptedException
Sends an Are You There sequence and waits for the result.


addOptionHandler

void addOptionHandler(TelnetOptionHandler opthand)
                throws InvalidTelnetOptionException
Registers a new TelnetOptionHandler for this telnet to use.


deleteOptionHandler

void deleteOptionHandler(int optcode)
                   throws InvalidTelnetOptionException
Unregisters a TelnetOptionHandler.


_registerSpyStream

void _registerSpyStream(java.io.OutputStream spystream)
Registers an OutputStream for spying what's going on in the Telnet session.


_stopSpyStream

void _stopSpyStream()
Stops spying this Telnet.


_spyRead

void _spyRead(int ch)
Sends a read char on the spy stream.


_spyWrite

void _spyWrite(int ch)
Sends a written char on the spy stream.


registerNotifHandler

public void registerNotifHandler(TelnetNotificationHandler notifhand)
Registers a notification handler to which will be sent notifications of received telnet option negotiation commands.


unregisterNotifHandler

public void unregisterNotifHandler()
Unregisters the current notification handler.