Package com.sshtools.daemon.terminal
Class TerminalIO
- java.lang.Object
-
- com.sshtools.daemon.terminal.TerminalIO
-
- All Implemented Interfaces:
PseudoTerminal
public class TerminalIO extends java.lang.Object implements PseudoTerminal
- Version:
- $Revision: 1.13 $
- Author:
- $author$
-
-
Field Summary
Fields Modifier and Type Field Description static intBACKSPACEstatic intBCOLORstatic intBELstatic intBLACKstatic intBLINKstatic intBLINK_OFFstatic intBLUEstatic intBOLDstatic intBOLD_OFFstatic intBSstatic intBYTEMISSINGstatic intCharacterUpdatestatic intCOLORINITstatic intCRstatic java.lang.StringCRLFstatic intCYANstatic intDELstatic intDELETEstatic intDOWNstatic intEBOLstatic intEBOSstatic intEditBufferstatic intEELstatic intEEOLstatic intEEOSstatic intEESstatic intENTERstatic intEOL_CRstatic intEOL_CRLFstatic intESCAPEstatic intFCOLORstatic intGREENstatic intHANDLEDstatic int[]HOMEstatic intIOERRORstatic intITALICstatic intITALIC_OFFstatic intLEFTstatic intLFstatic intLineEditBufferstatic intLineUpdatestatic intLOGOUTREQUESTstatic intMAGENTAstatic intREDstatic intRESETstatic intRESTORECURSORstatic intRIGHTstatic intScreenpartUpdatestatic intSTORECURSORstatic intSTYLEstatic intTABULATORstatic intUNDERLINEDstatic intUNDERLINED_OFFstatic intUNRECOGNIZEDstatic intUPstatic intwhitestatic intYELLOW-
Fields inherited from interface com.sshtools.j2ssh.session.PseudoTerminal
CS7, CS8, ECHO, ECHOCTL, ECHOE, ECHOK, ECHOKE, ECHONL, ICANON, ICRNL, IEXTEN, IGNCR, IGNPAR, IMAXBEL, INLCR, INPCK, ISIG, ISTRIP, IUCLC, IXANY, IXOFF, IXON, NOFLSH, OCRNL, OLCUC, ONLCR, ONLRET, ONOCR, OPOST, PARENB, PARMRK, PARODD, PENDIN, TOSTOP, TTY_OP_END, TTY_OP_ISPEED, TTY_OP_OSPEED, VDISCARD, VDSUSP, VEOF, VEOL, VEOL2, VERASE, VFLUSH, VINTR, VKILL, VLNEXT, VQUIT, VREPRINT, VSTART, VSTATUS, VSTOP, VSUSP, VSWTCH, VWERASE, XCASE
-
-
Constructor Summary
Constructors Constructor Description TerminalIO(java.io.InputStream in, java.io.OutputStream out, java.lang.String term, int cols, int rows)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattachStreams(java.io.InputStream in, java.io.OutputStream out)voidbell()voidbindSlaveInputStream(java.io.InputStream slaveIn)voidbindSlaveOutputStream(java.io.OutputStream slaveOut)voidclose()voidcloseInput()voidcloseOutput()booleandefineScrollRegion(int topmargin, int bottommargin)voiddetachStreams()voideraseLine()voideraseScreen()voideraseToBeginOfLine()voideraseToBeginOfScreen()voideraseToEndOfLine()voideraseToEndOfScreen()voidflush()java.io.InputStreamgetAttachedInputStream()java.io.OutputStreamgetAttachedOutputStream()intgetColumns()java.lang.StringgetEncodedTerminalModes()intgetEOL()java.lang.StringgetEOLString()intgetHeight()java.io.InputStreamgetMasterInputStream()intgetRows()java.io.OutputStreamgetSlaveOutputStream()java.lang.StringgetTerm()TerminalgetTerminal()intgetWidth()voidhomeCursor()booleanisAutoflushing()booleanisSignalling()voidmoveCursor(int direction, int times)voidmoveDown(int times)voidmoveLeft(int times)voidmoveRight(int times)voidmoveUp(int times)voidprintln()voidprintln(java.lang.String str)intread()voidresetAttributes()voidrestoreCursor()voidsetAutoflushing(boolean b)voidsetBackgroundColor(int color)voidsetBlink(boolean b)voidsetBold(boolean b)voidsetCursor(int row, int col)voidsetDefaultTerminal()voidsetEOL(int eol)voidsetForegroundColor(int color)voidsetItalic(boolean b)voidsetSignalling(boolean bool)voidsetTerminal(java.lang.String terminalName)voidsetUnderlined(boolean b)voidstoreCursor()voidwrite(byte b)voidwrite(byte[] sequence)voidwrite(char ch)voidwrite(int i)voidwrite(int[] sequence)voidwrite(java.lang.String str)
-
-
-
Field Detail
-
EOL_CRLF
public static final int EOL_CRLF
- See Also:
- Constant Field Values
-
EOL_CR
public static final int EOL_CR
- See Also:
- Constant Field Values
-
HOME
public static final int[] HOME
-
IOERROR
public static final int IOERROR
- See Also:
- Constant Field Values
-
UP
public static final int UP
- See Also:
- Constant Field Values
-
DOWN
public static final int DOWN
- See Also:
- Constant Field Values
-
RIGHT
public static final int RIGHT
- See Also:
- Constant Field Values
-
LEFT
public static final int LEFT
- See Also:
- Constant Field Values
-
STORECURSOR
public static final int STORECURSOR
- See Also:
- Constant Field Values
-
RESTORECURSOR
public static final int RESTORECURSOR
- See Also:
- Constant Field Values
-
EEOL
public static final int EEOL
- See Also:
- Constant Field Values
-
EBOL
public static final int EBOL
- See Also:
- Constant Field Values
-
EEL
public static final int EEL
- See Also:
- Constant Field Values
-
EEOS
public static final int EEOS
- See Also:
- Constant Field Values
-
EBOS
public static final int EBOS
- See Also:
- Constant Field Values
-
EES
public static final int EES
- See Also:
- Constant Field Values
-
ESCAPE
public static final int ESCAPE
- See Also:
- Constant Field Values
-
BYTEMISSING
public static final int BYTEMISSING
- See Also:
- Constant Field Values
-
UNRECOGNIZED
public static final int UNRECOGNIZED
- See Also:
- Constant Field Values
-
ENTER
public static final int ENTER
- See Also:
- Constant Field Values
-
TABULATOR
public static final int TABULATOR
- See Also:
- Constant Field Values
-
DELETE
public static final int DELETE
- See Also:
- Constant Field Values
-
BACKSPACE
public static final int BACKSPACE
- See Also:
- Constant Field Values
-
COLORINIT
public static final int COLORINIT
- See Also:
- Constant Field Values
-
HANDLED
public static final int HANDLED
- See Also:
- Constant Field Values
-
LOGOUTREQUEST
public static final int LOGOUTREQUEST
- See Also:
- Constant Field Values
-
LineUpdate
public static final int LineUpdate
- See Also:
- Constant Field Values
-
CharacterUpdate
public static final int CharacterUpdate
- See Also:
- Constant Field Values
-
ScreenpartUpdate
public static final int ScreenpartUpdate
- See Also:
- Constant Field Values
-
EditBuffer
public static final int EditBuffer
- See Also:
- Constant Field Values
-
LineEditBuffer
public static final int LineEditBuffer
- See Also:
- Constant Field Values
-
BEL
public static final int BEL
- See Also:
- Constant Field Values
-
BS
public static final int BS
- See Also:
- Constant Field Values
-
DEL
public static final int DEL
- See Also:
- Constant Field Values
-
CR
public static final int CR
- See Also:
- Constant Field Values
-
LF
public static final int LF
- See Also:
- Constant Field Values
-
FCOLOR
public static final int FCOLOR
- See Also:
- Constant Field Values
-
BCOLOR
public static final int BCOLOR
- See Also:
- Constant Field Values
-
STYLE
public static final int STYLE
- See Also:
- Constant Field Values
-
RESET
public static final int RESET
- See Also:
- Constant Field Values
-
BOLD
public static final int BOLD
- See Also:
- Constant Field Values
-
BOLD_OFF
public static final int BOLD_OFF
- See Also:
- Constant Field Values
-
ITALIC
public static final int ITALIC
- See Also:
- Constant Field Values
-
ITALIC_OFF
public static final int ITALIC_OFF
- See Also:
- Constant Field Values
-
BLINK
public static final int BLINK
- See Also:
- Constant Field Values
-
BLINK_OFF
public static final int BLINK_OFF
- See Also:
- Constant Field Values
-
UNDERLINED
public static final int UNDERLINED
- See Also:
- Constant Field Values
-
UNDERLINED_OFF
public static final int UNDERLINED_OFF
- See Also:
- Constant Field Values
-
BLACK
public static final int BLACK
- See Also:
- Constant Field Values
-
RED
public static final int RED
- See Also:
- Constant Field Values
-
GREEN
public static final int GREEN
- See Also:
- Constant Field Values
-
YELLOW
public static final int YELLOW
- See Also:
- Constant Field Values
-
BLUE
public static final int BLUE
- See Also:
- Constant Field Values
-
MAGENTA
public static final int MAGENTA
- See Also:
- Constant Field Values
-
CYAN
public static final int CYAN
- See Also:
- Constant Field Values
-
white
public static final int white
- See Also:
- Constant Field Values
-
CRLF
public static final java.lang.String CRLF
- See Also:
- Constant Field Values
-
-
Method Detail
-
getMasterInputStream
public java.io.InputStream getMasterInputStream()
- Returns:
-
bindSlaveInputStream
public void bindSlaveInputStream(java.io.InputStream slaveIn)
- Parameters:
slaveIn-
-
bindSlaveOutputStream
public void bindSlaveOutputStream(java.io.OutputStream slaveOut)
- Parameters:
slaveOut-
-
getSlaveOutputStream
public java.io.OutputStream getSlaveOutputStream()
- Returns:
-
getWidth
public int getWidth()
- Specified by:
getWidthin interfacePseudoTerminal- Returns:
-
getHeight
public int getHeight()
- Specified by:
getHeightin interfacePseudoTerminal- Returns:
-
getTerm
public java.lang.String getTerm()
- Specified by:
getTermin interfacePseudoTerminal- Returns:
-
getEncodedTerminalModes
public java.lang.String getEncodedTerminalModes()
- Specified by:
getEncodedTerminalModesin interfacePseudoTerminal- Returns:
-
getAttachedInputStream
public java.io.InputStream getAttachedInputStream() throws java.io.IOException- Throws:
java.io.IOException
-
getAttachedOutputStream
public java.io.OutputStream getAttachedOutputStream() throws java.io.IOException- Returns:
- Throws:
java.io.IOException
-
detachStreams
public void detachStreams()
-
getEOL
public int getEOL()
- Returns:
-
getEOLString
public java.lang.String getEOLString()
- Returns:
-
setEOL
public void setEOL(int eol)
- Parameters:
eol-
-
attachStreams
public void attachStreams(java.io.InputStream in, java.io.OutputStream out)- Parameters:
in-out-
-
read
public int read() throws java.io.IOException- Returns:
- Throws:
java.io.IOException
-
write
public void write(char ch) throws java.io.IOException- Parameters:
ch-- Throws:
java.io.IOException
-
write
public void write(java.lang.String str) throws java.io.IOException- Parameters:
str-- Throws:
java.io.IOException
-
println
public void println(java.lang.String str) throws java.io.IOException- Parameters:
str-- Throws:
java.io.IOException
-
println
public void println() throws java.io.IOException- Throws:
java.io.IOException
-
eraseToEndOfLine
public void eraseToEndOfLine() throws java.io.IOException- Throws:
java.io.IOException
-
eraseToBeginOfLine
public void eraseToBeginOfLine() throws java.io.IOException- Throws:
java.io.IOException
-
eraseLine
public void eraseLine() throws java.io.IOException- Throws:
java.io.IOException
-
eraseToEndOfScreen
public void eraseToEndOfScreen() throws java.io.IOException- Throws:
java.io.IOException
-
eraseToBeginOfScreen
public void eraseToBeginOfScreen() throws java.io.IOException- Throws:
java.io.IOException
-
eraseScreen
public void eraseScreen() throws java.io.IOException- Throws:
java.io.IOException
-
moveCursor
public void moveCursor(int direction, int times) throws java.io.IOException- Parameters:
direction-times-- Throws:
java.io.IOException
-
moveLeft
public void moveLeft(int times) throws java.io.IOException- Parameters:
times-- Throws:
java.io.IOException
-
moveRight
public void moveRight(int times) throws java.io.IOException- Parameters:
times-- Throws:
java.io.IOException
-
moveUp
public void moveUp(int times) throws java.io.IOException- Parameters:
times-- Throws:
java.io.IOException
-
moveDown
public void moveDown(int times) throws java.io.IOException- Parameters:
times-- Throws:
java.io.IOException
-
setCursor
public void setCursor(int row, int col) throws java.io.IOException- Parameters:
row-col-- Throws:
java.io.IOException
-
homeCursor
public void homeCursor() throws java.io.IOException- Throws:
java.io.IOException
-
storeCursor
public void storeCursor() throws java.io.IOException- Throws:
java.io.IOException
-
restoreCursor
public void restoreCursor() throws java.io.IOException- Throws:
java.io.IOException
-
closeInput
public void closeInput() throws java.io.IOException- Throws:
java.io.IOException
-
write
public void write(byte b) throws java.io.IOException- Parameters:
b-- Throws:
java.io.IOException
-
write
public void write(int i) throws java.io.IOException- Parameters:
i-- Throws:
java.io.IOException
-
write
public void write(byte[] sequence) throws java.io.IOException- Parameters:
sequence-- Throws:
java.io.IOException
-
write
public void write(int[] sequence) throws java.io.IOException- Parameters:
sequence-- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Throws:
java.io.IOException
-
closeOutput
public void closeOutput() throws java.io.IOException- Throws:
java.io.IOException
-
setSignalling
public void setSignalling(boolean bool)
- Parameters:
bool-
-
isSignalling
public boolean isSignalling()
- Returns:
-
bell
public void bell() throws java.io.IOException- Throws:
java.io.IOException
-
defineScrollRegion
public boolean defineScrollRegion(int topmargin, int bottommargin) throws java.io.IOException- Parameters:
topmargin-bottommargin-- Returns:
- Throws:
java.io.IOException
-
setForegroundColor
public void setForegroundColor(int color) throws java.io.IOException- Parameters:
color-- Throws:
java.io.IOException
-
setBackgroundColor
public void setBackgroundColor(int color) throws java.io.IOException- Parameters:
color-- Throws:
java.io.IOException
-
setBold
public void setBold(boolean b) throws java.io.IOException- Parameters:
b-- Throws:
java.io.IOException
-
setUnderlined
public void setUnderlined(boolean b) throws java.io.IOException- Parameters:
b-- Throws:
java.io.IOException
-
setItalic
public void setItalic(boolean b) throws java.io.IOException- Parameters:
b-- Throws:
java.io.IOException
-
setBlink
public void setBlink(boolean b) throws java.io.IOException- Parameters:
b-- Throws:
java.io.IOException
-
resetAttributes
public void resetAttributes() throws java.io.IOException- Throws:
java.io.IOException
-
isAutoflushing
public boolean isAutoflushing()
- Returns:
-
setAutoflushing
public void setAutoflushing(boolean b)
- Parameters:
b-
-
close
public void close() throws java.io.IOException- Throws:
java.io.IOException
-
getTerminal
public Terminal getTerminal()
- Returns:
-
setDefaultTerminal
public void setDefaultTerminal() throws java.io.IOException- Throws:
java.io.IOException
-
setTerminal
public void setTerminal(java.lang.String terminalName) throws java.io.IOException- Parameters:
terminalName-- Throws:
java.io.IOException
-
getRows
public int getRows()
- Specified by:
getRowsin interfacePseudoTerminal- Returns:
-
getColumns
public int getColumns()
- Specified by:
getColumnsin interfacePseudoTerminal- Returns:
-
-