com.mindbright.net.telnet
public class TelnetTerminalAdapter extends TerminalInputChaff implements TelnetEventHandler
TerminalWindow
to a
telnet server.TelnetNVT
,
TerminalWindow
,
TerminalInputChaff
Constructor and Description |
---|
TelnetTerminalAdapter(java.io.InputStream in,
java.io.OutputStream out,
TerminalWindow terminal)
Connects the given
TerminalWindow to a telnet
server at the other end of the provided streams. |
Modifier and Type | Method and Description |
---|---|
TelnetNVT |
getTelnetNVT()
Get the underlying telnet protocol instance.
|
void |
interpretAsCommand(int cmd)
Called to handle some telnet protocol commands from the server.
|
boolean |
isBuffered()
Tells if input is sent directly to server (raw mode) or line by
line (cooked).
|
boolean |
optionNegotiation(int option,
int request)
Called to handle option negotiation packets from the server.
|
void |
optionSubNegotiation(int option,
byte[] params)
Called to handle option negotiation packets from the server.
|
void |
receiveData(byte b)
Handle a byte received from the server.
|
void |
sendBreak()
Send a break to the terminal server.
|
void |
sendBytes(byte[] b)
Send a number of bytes to the server.
|
void |
sendBytesDirect(byte[] b)
Send a number of bytes directly to the server.
|
protected void |
sendFakeChar()
Send a fake character to the server.
|
protected void |
sendTypedChar(int c)
Send a typed char to the server.
|
void |
signalWindowChanged(int rows,
int cols,
int vpixels,
int hpixels)
Tell the telnet server that our window has changed size.
|
dispenseChaff, isChaffActive, run, signalTermTypeChanged, startChaff, stopChaff, typedChar, typedChar
public TelnetTerminalAdapter(java.io.InputStream in, java.io.OutputStream out, TerminalWindow terminal)
TerminalWindow
to a telnet
server at the other end of the provided streams.in
- stream from which data from the telnet server is readout
- stream over which to send data to the telnet serverterminal
- instance of terminal window to connect topublic TelnetNVT getTelnetNVT()
public boolean isBuffered()
public void interpretAsCommand(int cmd)
TelnetEventHandler
interpretAsCommand
in interface TelnetEventHandler
public void optionSubNegotiation(int option, byte[] params) throws java.io.IOException
TelnetEventHandler
sendOptionSubNegotiation
optionSubNegotiation
in interface TelnetEventHandler
java.io.IOException
public boolean optionNegotiation(int option, int request) throws java.io.IOException
TelnetEventHandler
doOption
and willOption
optionNegotiation
in interface TelnetEventHandler
java.io.IOException
public void receiveData(byte b)
TelnetEventHandler
receiveData
in interface TelnetEventHandler
protected void sendTypedChar(int c)
sendTypedChar
in class TerminalInputChaff
c
- typed characterprotected void sendFakeChar()
TerminalInputChaff
sendFakeChar
in class TerminalInputChaff
public void sendBytes(byte[] b)
sendBytes
in interface TerminalInputListener
b
- array of bytes representing characters to inputpublic void sendBytesDirect(byte[] b)
sendBytesDirect
in interface TerminalInputListener
b
- array of bytes representing characters to sendpublic void signalWindowChanged(int rows, int cols, int vpixels, int hpixels)
signalWindowChanged
in interface TerminalInputListener
rows
- new number of rowscols
- new number of columnsvpixels
- number of verticial pixelshpixels
- number of horizontal pixelspublic void sendBreak()
sendBreak
in interface TerminalInputListener
sendBreak
in class TerminalInputChaff