com.mindbright.ssh
Class SSHStdIO

java.lang.Object
  extended by com.mindbright.ssh.SSHStdIO
All Implemented Interfaces:
SSHConsole, TerminalInputListener

public final class SSHStdIO
extends java.lang.Object
implements TerminalInputListener, SSHConsole


Nested Class Summary
static class SSHStdIO.SSHExternalMessage
           
 
Field Summary
protected  boolean isConnected
           
 
Constructor Summary
SSHStdIO()
           
 
Method Summary
 void breakPromptLine()
           
 void breakPromptLine(java.lang.String msg)
           
 TerminalWindow getTerminal()
           
 boolean isConnected()
           
 void print(java.lang.String str)
           
 void println(java.lang.String str)
           
 java.lang.String promptLine(java.lang.String prompt, java.lang.String defaultVal, boolean echoStar)
           
 java.lang.String readLine(java.lang.String defaultVal)
           
 void sendBreak()
          Called when the user sends a break to the terminal
 void sendBytes(byte[] b)
          May be called when the user pastes data.
 void sendBytesDirect(byte[] b)
          Send some bytes directly to the host.
 void serverConnect(SSHChannelController controller, SSHCipher sndCipher)
           
 void serverDisconnect(java.lang.String reason)
           
 void setClient(SSHInteractiveClient client)
           
 void setOwnerContainer(java.awt.Container ownerContainer)
           
 void setOwnerName(java.lang.String ownerName)
           
 void setTerminal(TerminalWin term)
           
 void signalTermTypeChanged(java.lang.String newTermType)
          Called when the terminal type has changed.
 void signalWindowChanged(int rows, int cols, int vpixels, int hpixels)
          Called when the size of the terminal window has changed.
 void stderrWriteString(byte[] str)
           
 void stdoutWriteString(byte[] str)
           
 void typedChar(byte[] b)
          Called when the user types a character
 void typedChar(char c)
          Called when the user types a character
 void updateTitle()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isConnected

protected boolean isConnected
Constructor Detail

SSHStdIO

public SSHStdIO()
Method Detail

isConnected

public boolean isConnected()

setTerminal

public void setTerminal(TerminalWin term)

setClient

public void setClient(SSHInteractiveClient client)

setOwnerContainer

public void setOwnerContainer(java.awt.Container ownerContainer)

setOwnerName

public void setOwnerName(java.lang.String ownerName)

breakPromptLine

public void breakPromptLine()

breakPromptLine

public void breakPromptLine(java.lang.String msg)

readLine

public java.lang.String readLine(java.lang.String defaultVal)

promptLine

public java.lang.String promptLine(java.lang.String prompt,
                                   java.lang.String defaultVal,
                                   boolean echoStar)
                            throws java.io.IOException
Throws:
java.io.IOException

updateTitle

public void updateTitle()

getTerminal

public TerminalWindow getTerminal()
Specified by:
getTerminal in interface SSHConsole

stdoutWriteString

public void stdoutWriteString(byte[] str)
Specified by:
stdoutWriteString in interface SSHConsole

stderrWriteString

public void stderrWriteString(byte[] str)
Specified by:
stderrWriteString in interface SSHConsole

print

public void print(java.lang.String str)
Specified by:
print in interface SSHConsole

println

public void println(java.lang.String str)
Specified by:
println in interface SSHConsole

serverConnect

public void serverConnect(SSHChannelController controller,
                          SSHCipher sndCipher)
Specified by:
serverConnect in interface SSHConsole

serverDisconnect

public void serverDisconnect(java.lang.String reason)
Specified by:
serverDisconnect in interface SSHConsole

typedChar

public void typedChar(char c)
Description copied from interface: TerminalInputListener
Called when the user types a character

Specified by:
typedChar in interface TerminalInputListener
Parameters:
c - typed character

typedChar

public void typedChar(byte[] b)
Description copied from interface: TerminalInputListener
Called when the user types a character

Specified by:
typedChar in interface TerminalInputListener
Parameters:
b - byte code representation fo the character encoded in the current encoding.

sendBytes

public void sendBytes(byte[] b)
Description copied from interface: TerminalInputListener
May be called when the user pastes data. It may also be called by some external entity whishing to simulate multiple key presses.

Specified by:
sendBytes in interface TerminalInputListener
Parameters:
b - array of bytes representing characters to input

sendBytesDirect

public void sendBytesDirect(byte[] b)
Description copied from interface: TerminalInputListener
Send some bytes directly to the host. This does not echo the characters and bypasses any line buffering. This is typically used when replying to some query from the host.

Specified by:
sendBytesDirect in interface TerminalInputListener
Parameters:
b - array of bytes representing characters to send

signalWindowChanged

public void signalWindowChanged(int rows,
                                int cols,
                                int vpixels,
                                int hpixels)
Description copied from interface: TerminalInputListener
Called when the size of the terminal window has changed.

Specified by:
signalWindowChanged in interface TerminalInputListener
Parameters:
rows - new number of rows
cols - new number of columns
vpixels - new number of vertical pixels
hpixels - new number of horizontal pixels

signalTermTypeChanged

public void signalTermTypeChanged(java.lang.String newTermType)
Description copied from interface: TerminalInputListener
Called when the terminal type has changed. That is when the user has changed which terminal type this terminal window should emulate.

Specified by:
signalTermTypeChanged in interface TerminalInputListener
Parameters:
newTermType - new terminal type to emulate

sendBreak

public void sendBreak()
Description copied from interface: TerminalInputListener
Called when the user sends a break to the terminal

Specified by:
sendBreak in interface TerminalInputListener