TelnetD at SF

net.wimpi.telnetd.io
Class TerminalIO

java.lang.Object
  extended bynet.wimpi.telnetd.io.TerminalIO
All Implemented Interfaces:
BasicTerminalIO

public class TerminalIO
extends java.lang.Object
implements BasicTerminalIO

Class for Terminal specific I/O. It represents the layer between the application layer and the generic telnet I/O. Terminal specific I/O is achieved via pluggable terminal classes

Version:
2.0 (14/03/2005)
Author:
Dieter Wimberger
See Also:
TelnetIO, Terminal

Field Summary
static int BACKSPACE
           
static int BCOLOR
           
static int BEL
          Network Virtual Terminal Specific Keys Thats what we have to offer at least.
static int BLINK
           
static int BLINK_OFF
           
static int BOLD
           
static int BOLD_OFF
           
static int BS
           
static int BYTEMISSING
           
static int CharacterUpdate
          Internal UpdateType Constants
static int COLORINIT
           
static int CR
           
static int DEL
           
static int DELETE
           
static int DEVICERESET
           
static int DOWN
           
static int EBOL
           
static int EBOS
           
static int EditBuffer
          Internal BufferType Constants
static int EEL
           
static int EEOL
           
static int EEOS
           
static int EES
           
static int ENTER
           
static int ESCAPE
           
static int FCOLOR
           
static int HANDLED
           
static int[] HOME
          Terminal independent representation constants for terminal functions.
static int IOERROR
           
static int ITALIC
           
static int ITALIC_OFF
           
static int LEFT
           
static int LF
           
static int LineEditBuffer
          Internal BufferType Constants
static int LineUpdate
          Internal UpdateType Constants
static int LINEWRAP
           
static int LOGOUTREQUEST
           
static int NOLINEWRAP
           
static int RESET
           
static int RESTORECURSOR
           
static int RIGHT
           
static int ScreenpartUpdate
          Internal UpdateType Constants
static int STORECURSOR
           
static int STYLE
           
static int TABULATOR
           
static int UNDERLINED
           
static int UNDERLINED_OFF
           
static int UNRECOGNIZED
           
static int UP
           
 
Fields inherited from interface net.wimpi.telnetd.io.BasicTerminalIO
BLACK, BLUE, CRLF, CYAN, GREEN, MAGENTA, RED, WHITE, YELLOW
 
Constructor Summary
TerminalIO(Connection con)
          Constructor of the TerminalIO class.
 
Method Summary
 void bell()
          Method to write the NVT defined BEL onto the stream.
 void close()
          Closes this BasicTerminalIO.
 boolean defineScrollRegion(int topmargin, int bottommargin)
          EXPERIMENTAL, not defined in the interface.
 void eraseLine()
          Method that erases the entire actual line.
 void eraseScreen()
          Method that erases the entire screen
 void eraseToBeginOfLine()
          Method that erases in the actual line * from the actual cursor position to the beginning of the line.
 void eraseToBeginOfScreen()
          Method that erases in the terminal screen * from the actual cursor postition to the beginning of the screen.
 void eraseToEndOfLine()
          ********************************************************************* Erase methods * **********************************************************************
 void eraseToEndOfScreen()
          Method that erases in the terminal screen * from the actual cursor position to the end of the screen.
 void flush()
          Method to flush the Low-Level Buffer
 void forceBold(boolean b)
          Method that forces bold as attribute for writing on the terminal
 int getColumns()
          Method to retrieve the actual columns on the clients temrinal * screen
 int getRows()
          Method to retrieve the actual rows on the clients terminal * screen
 Terminal getTerminal()
          Accessor method to get the active terminal object
 void homeCursor()
          Method that places the cursor at "home", which is defining * first Row,first Column
 boolean isAutoflushing()
          Accessor method for the autoflushing mechanism.
 boolean isLineWrapping()
          Tests if terminal is in linewrapping mode
 boolean isSignalling()
          Accessor method for checking signalling attribute
 boolean isTerminalGeometryChanged()
          Accessor Method for the terminal geometry changed flag
 void moveCursor(int direction, int times)
          ********************************************************************* Cursor related methods * **********************************************************************
 void moveDown(int times)
          Convenience method to move the cursor down
 void moveLeft(int times)
          Convenience method to move cursor to the left
 void moveRight(int times)
          Convenience method to move cursor to the right
 void moveUp(int times)
          Convenience method to move the cursor up
 int read()
          Read a single character and take care for terminal function calls.
 void resetAttributes()
          Method that resets all graphic rendition attributes for writing on the * terminal.
 void resetTerminal()
          Resets the terminal device.
 void restoreCursor()
          Method that restores the last Cursor position, either client-side, * or if not possible server-side
 void setAutoflushing(boolean b)
          Mutator method for the autoflushing mechanism.
 void setBackgroundColor(int color)
          Method that sets the background color for writing on the terminal
 void setBlink(boolean b)
          Method that sets blink attribute for writing on the terminal
 void setBold(boolean b)
          Method that sets bold as attribute for writing on the terminal
 void setCursor(int row, int col)
          Method that places the cursor on the terminal * on the given absolute position
 void setDefaultTerminal()
          Sets the default terminal ,which will either be the negotiated one for the connection, or the systems default.
 void setForegroundColor(int color)
          Method that sets the foreground color for writing to the terminal
 void setItalic(boolean b)
          Method that sets italic as attribute for writing on the terminal
 void setLinewrapping(boolean b)
          Sets the linewrapping mode
 void setSignalling(boolean bool)
          ********************************************************************* Special terminal function methods * **********************************************************************
 void setTerminal(java.lang.String terminalName)
          Mutator method to set the active terminal object If the String does not name a terminal we support then the vt100 is the terminal of selection automatically.
 void setUnderlined(boolean b)
          Method that sets underlined as attribute for writing on the terminal
 void storeCursor()
          Method that stores the actual Cursor position, either client-side, * or if not possible server-side
 void write(byte b)
          Method that writes a raw byte to the terminal
 void write(char ch)
          Method that writes a character to the terminal
 void write(java.lang.String str)
          Method that writes a String to the terminal, * * @param str String that should be written to the terminal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HOME

public static final int[] HOME
Terminal independent representation constants for terminal functions.


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
Internal UpdateType Constants

See Also:
Constant Field Values

CharacterUpdate

public static final int CharacterUpdate
Internal UpdateType Constants

See Also:
Constant Field Values

ScreenpartUpdate

public static final int ScreenpartUpdate
Internal UpdateType Constants

See Also:
Constant Field Values

EditBuffer

public static final int EditBuffer
Internal BufferType Constants

See Also:
Constant Field Values

LineEditBuffer

public static final int LineEditBuffer
Internal BufferType Constants

See Also:
Constant Field Values

BEL

public static final int BEL
Network Virtual Terminal Specific Keys Thats what we have to offer at least.

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

DEVICERESET

public static final int DEVICERESET
See Also:
Constant Field Values

LINEWRAP

public static final int LINEWRAP
See Also:
Constant Field Values

NOLINEWRAP

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

TerminalIO

public TerminalIO(Connection con)
Constructor of the TerminalIO class.

Parameters:
con - Connection the instance will be working for
Method Detail

read

public int read()
         throws java.io.IOException
Read a single character and take care for terminal function calls.

Specified by:
read in interface BasicTerminalIO
Returns:
  • character read
  • IOERROR in case of an error
  • DELETE,BACKSPACE,TABULATOR,ESCAPE,COLORINIT,LOGOUTREQUEST
  • UP,DOWN,LEFT,RIGHT
Throws:
java.io.IOException

write

public void write(byte b)
           throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that writes a raw byte to the terminal. * @param b a byte value to be written.

Specified by:
write in interface BasicTerminalIO
Throws:
java.io.IOException

write

public void write(char ch)
           throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that writes a character to the terminal. * * @param ch Character that should be written on the screen

Specified by:
write in interface BasicTerminalIO
Throws:
java.io.IOException

write

public void write(java.lang.String str)
           throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that writes a String to the terminal, * * @param str String that should be written to the terminal.

Specified by:
write in interface BasicTerminalIO
Throws:
java.io.IOException

eraseToEndOfLine

public void eraseToEndOfLine()
                      throws java.io.IOException
********************************************************************* Erase methods * **********************************************************************

Specified by:
eraseToEndOfLine in interface BasicTerminalIO
Throws:
java.io.IOException

eraseToBeginOfLine

public void eraseToBeginOfLine()
                        throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that erases in the actual line * from the actual cursor position to the beginning of the line.

Specified by:
eraseToBeginOfLine in interface BasicTerminalIO
Throws:
java.io.IOException

eraseLine

public void eraseLine()
               throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that erases the entire actual line.

Specified by:
eraseLine in interface BasicTerminalIO
Throws:
java.io.IOException

eraseToEndOfScreen

public void eraseToEndOfScreen()
                        throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that erases in the terminal screen * from the actual cursor position to the end of the screen.

Specified by:
eraseToEndOfScreen in interface BasicTerminalIO
Throws:
java.io.IOException

eraseToBeginOfScreen

public void eraseToBeginOfScreen()
                          throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that erases in the terminal screen * from the actual cursor postition to the beginning of the screen.

Specified by:
eraseToBeginOfScreen in interface BasicTerminalIO
Throws:
java.io.IOException

eraseScreen

public void eraseScreen()
                 throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that erases the entire screen. * Note: *

Specified by:
eraseScreen in interface BasicTerminalIO
Throws:
java.io.IOException

moveCursor

public void moveCursor(int direction,
                       int times)
                throws java.io.IOException
********************************************************************* Cursor related methods * **********************************************************************

Specified by:
moveCursor in interface BasicTerminalIO
Throws:
java.io.IOException

moveLeft

public void moveLeft(int times)
              throws java.io.IOException
Description copied from interface: BasicTerminalIO
Convenience method to move cursor to the left. * Wraps moveCursor method. * * @param times Integer that represents the times the cursor should be moved. * @see BasicTerminalIO#moveCursor

Specified by:
moveLeft in interface BasicTerminalIO
Throws:
java.io.IOException

moveRight

public void moveRight(int times)
               throws java.io.IOException
Description copied from interface: BasicTerminalIO
Convenience method to move cursor to the right. * Wraps moveCursor method. * * @param times Integer that represents the times the cursor should be moved. * @see BasicTerminalIO#moveCursor

Specified by:
moveRight in interface BasicTerminalIO
Throws:
java.io.IOException

moveUp

public void moveUp(int times)
            throws java.io.IOException
Description copied from interface: BasicTerminalIO
Convenience method to move the cursor up. * Wraps moveCursor method. * * @param times Integer that represents the times the cursor should be moved. * @see BasicTerminalIO#moveCursor

Specified by:
moveUp in interface BasicTerminalIO
Throws:
java.io.IOException

moveDown

public void moveDown(int times)
              throws java.io.IOException
Description copied from interface: BasicTerminalIO
Convenience method to move the cursor down. * Wraps moveCursor method. * * @param times Integer that represents the times the cursor should be moved. * @see BasicTerminalIO#moveCursor

Specified by:
moveDown in interface BasicTerminalIO
Throws:
java.io.IOException

setCursor

public void setCursor(int row,
                      int col)
               throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that places the cursor on the terminal * on the given absolute position. * * @param row Integer that represents the desired row coord. * @param col Integer that represents the desired column coord.

Specified by:
setCursor in interface BasicTerminalIO
Throws:
java.io.IOException

homeCursor

public void homeCursor()
                throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that places the cursor at "home", which is defining * first Row,first Column. * Note that it might be wrapping moveCursor, or be a specific * Escape Sequence.

Specified by:
homeCursor in interface BasicTerminalIO
Throws:
java.io.IOException

storeCursor

public void storeCursor()
                 throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that stores the actual Cursor position, either client-side, * or if not possible server-side. * Note: *

Specified by:
storeCursor in interface BasicTerminalIO
Throws:
java.io.IOException

restoreCursor

public void restoreCursor()
                   throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that restores the last Cursor position, either client-side, * or if not possible server-side. * Note: *

Specified by:
restoreCursor in interface BasicTerminalIO
Throws:
java.io.IOException

setSignalling

public void setSignalling(boolean bool)
********************************************************************* Special terminal function methods * **********************************************************************

Specified by:
setSignalling in interface BasicTerminalIO

isSignalling

public boolean isSignalling()
Description copied from interface: BasicTerminalIO
Accessor method for checking signalling attribute. * * @return Boolean that represents if signalling is either * turned on(true) or off(false).

Specified by:
isSignalling in interface BasicTerminalIO

bell

public void bell()
          throws java.io.IOException
Method to write the NVT defined BEL onto the stream. If signalling is off, the method simply returns, without any action.

Specified by:
bell in interface BasicTerminalIO
Throws:
java.io.IOException

defineScrollRegion

public boolean defineScrollRegion(int topmargin,
                                  int bottommargin)
                           throws java.io.IOException
EXPERIMENTAL, not defined in the interface.

Specified by:
defineScrollRegion in interface BasicTerminalIO
Throws:
java.io.IOException

setForegroundColor

public void setForegroundColor(int color)
                        throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that sets the foreground color for writing to the terminal. * * @param color Integer that represents one of the constant defined colors.

Specified by:
setForegroundColor in interface BasicTerminalIO
Throws:
java.io.IOException

setBackgroundColor

public void setBackgroundColor(int color)
                        throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that sets the background color for writing on the terminal. * * @param color Integer that represents one of the constant defined colors.

Specified by:
setBackgroundColor in interface BasicTerminalIO
Throws:
java.io.IOException

setBold

public void setBold(boolean b)
             throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that sets bold as attribute for writing on the terminal. * The final representation on the terminal might differ by the * terminal type. Most likely it will be represented by extra bright characters. * * @param b Boolean that flags on/off

Specified by:
setBold in interface BasicTerminalIO
Throws:
java.io.IOException

forceBold

public void forceBold(boolean b)
Description copied from interface: BasicTerminalIO
Method that forces bold as attribute for writing on the terminal. * The final representation on the terminal might differ by the * terminal type. Most likely it will be represented by extra bright characters. *

* This will not be affected by an attribute reset, and will be transmitted * more effectively for mixed style output. * * @param b Boolean that flags on/off

Specified by:
forceBold in interface BasicTerminalIO

setUnderlined

public void setUnderlined(boolean b)
                   throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that sets underlined as attribute for writing on the terminal. * The final representation on the terminal might differ by the * terminal type. * * @param b Boolean that flags on/off

Specified by:
setUnderlined in interface BasicTerminalIO
Throws:
java.io.IOException

setItalic

public void setItalic(boolean b)
               throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that sets italic as attribute for writing on the terminal. * The final representation on the terminal might differ by the * terminal type. * * @param b Boolean that flags on/off

Specified by:
setItalic in interface BasicTerminalIO
Throws:
java.io.IOException

setBlink

public void setBlink(boolean b)
              throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that sets blink attribute for writing on the terminal. * The final representation on the terminal might differ by the * terminal type. * * @param b Boolean that flags on/off

Specified by:
setBlink in interface BasicTerminalIO
Throws:
java.io.IOException

resetAttributes

public void resetAttributes()
                     throws java.io.IOException
Description copied from interface: BasicTerminalIO
Method that resets all graphic rendition attributes for writing on the * terminal.

* Note:
* This will affect all attributes. Although these selective resets are defined * in ECMA 048 (the successor of the ANSI X3.64 standard) they are obviously not * implemented for all attributes in standard terminal emulations. *

Specified by:
resetAttributes in interface BasicTerminalIO
Throws:
java.io.IOException

isAutoflushing

public boolean isAutoflushing()
Accessor method for the autoflushing mechanism.

Specified by:
isAutoflushing in interface BasicTerminalIO

resetTerminal

public void resetTerminal()
                   throws java.io.IOException
Description copied from interface: BasicTerminalIO
Resets the terminal device.

Specified by:
resetTerminal in interface BasicTerminalIO
Throws:
java.io.IOException

setLinewrapping

public void setLinewrapping(boolean b)
                     throws java.io.IOException
Description copied from interface: BasicTerminalIO
Sets the linewrapping mode. * * @param b true if linewrapping on, false otherwise.

Specified by:
setLinewrapping in interface BasicTerminalIO
Throws:
java.io.IOException

isLineWrapping

public boolean isLineWrapping()
Description copied from interface: BasicTerminalIO
Tests if terminal is in linewrapping mode. * * @return true if linewrapping, false otherwise.

Specified by:
isLineWrapping in interface BasicTerminalIO

setAutoflushing

public void setAutoflushing(boolean b)
Mutator method for the autoflushing mechanism.

Specified by:
setAutoflushing in interface BasicTerminalIO

flush

public void flush()
           throws java.io.IOException
Method to flush the Low-Level Buffer

Specified by:
flush in interface BasicTerminalIO
Throws:
java.io.IOException

close

public void close()
Description copied from interface: BasicTerminalIO
Closes this BasicTerminalIO.

Specified by:
close in interface BasicTerminalIO

getTerminal

public Terminal getTerminal()
Accessor method to get the active terminal object

Returns:
Object that implements Terminal

setDefaultTerminal

public void setDefaultTerminal()
                        throws java.io.IOException
Sets the default terminal ,which will either be the negotiated one for the connection, or the systems default.

Specified by:
setDefaultTerminal in interface BasicTerminalIO
Throws:
java.io.IOException

setTerminal

public void setTerminal(java.lang.String terminalName)
                 throws java.io.IOException
Mutator method to set the active terminal object If the String does not name a terminal we support then the vt100 is the terminal of selection automatically.

Specified by:
setTerminal in interface BasicTerminalIO
Parameters:
terminalName - String that represents common terminal name
Throws:
java.io.IOException

getRows

public int getRows()
Description copied from interface: BasicTerminalIO
Method to retrieve the actual rows on the clients terminal * screen. * * @return int that represents the number of rows.

Specified by:
getRows in interface BasicTerminalIO

getColumns

public int getColumns()
Description copied from interface: BasicTerminalIO
Method to retrieve the actual columns on the clients temrinal * screen. * * @return int that represents the number of columns.

Specified by:
getColumns in interface BasicTerminalIO

isTerminalGeometryChanged

public boolean isTerminalGeometryChanged()
Accessor Method for the terminal geometry changed flag


TelnetD at SF

Copyright © 2000-2005 Dieter Wimberger.