net.wimpi.telnetd.io
Interface BasicTerminalIO

All Known Implementing Classes:
TerminalIO

public interface BasicTerminalIO

Interface that represents the supported terminal oriented low-level I/O capabilities.

Version:
2.0 (16/07/2006)
Author:
Dieter Wimberger

Field Summary
static int BACKSPACE
          Backspace (defining the backspace key)
static int BLACK
          Black
static int BLUE
          Blue
static int COLORINIT
          Color init (defining ctrl-a atm)
static java.lang.String CRLF
          CRLF (defining carriage+linebreak which is obligation)
static int CYAN
          Cyan
static int DELETE
          Delete (defining the del key)
static int DOWN
          Right (defining a direction on the terminal)
static int ENTER
          Enter (defining the return or enter key)
static int GREEN
          Green
static int LEFT
          Down (defining a direction on the terminal)
static int LOGOUTREQUEST
          Logout request (defining ctrl-d atm)
static int MAGENTA
          Magenta
static int RED
          Red
static int RIGHT
          Up (defining a direction on the terminal)
static int TABULATOR
          Tabulator (defining the tab key)
static int UP
          Left (defining a direction on the terminal)
static int WHITE
          White
static int YELLOW
          Yellow
 
Method Summary
 void bell()
          Method that sends a signal to the user.
 void close()
          Closes this BasicTerminalIO.
 boolean defineScrollRegion(int topmargin, int bottommargin)
          Allows to define a scroll region.
 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()
          Method that erases in the line from the actual cursor position to the end of the line.
 void eraseToEndOfScreen()
          Method that erases in the terminal screen from the actual cursor position to the end of the screen.
 void flush()
          Method that ensures all written bytes to be send over the network.
 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.
 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.
 void moveCursor(int direction, int times)
          Method that moves the cursor relative from the actual position given times into a given direction.
 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()
          Method that retrieves Input from the underlying Stream, translating Terminal specific escape sequences and returning a (constant defined) key, or a character.
 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.
 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 b)
          Mutator method for the signalling attribute.
 void setTerminal(java.lang.String terminalname)
          Sets the terminal to be used for this BasicTerminalIO.
 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,
 

Field Detail

UP

static final int UP
Left (defining a direction on the terminal)

See Also:
Constant Field Values

DOWN

static final int DOWN
Right (defining a direction on the terminal)

See Also:
Constant Field Values

RIGHT

static final int RIGHT
Up (defining a direction on the terminal)

See Also:
Constant Field Values

LEFT

static final int LEFT
Down (defining a direction on the terminal)

See Also:
Constant Field Values

TABULATOR

static final int TABULATOR
Tabulator (defining the tab key)

See Also:
Constant Field Values

DELETE

static final int DELETE
Delete (defining the del key)

See Also:
Constant Field Values

BACKSPACE

static final int BACKSPACE
Backspace (defining the backspace key)

See Also:
Constant Field Values

ENTER

static final int ENTER
Enter (defining the return or enter key)

See Also:
Constant Field Values

COLORINIT

static final int COLORINIT
Color init (defining ctrl-a atm)

See Also:
Constant Field Values

LOGOUTREQUEST

static final int LOGOUTREQUEST
Logout request (defining ctrl-d atm)

See Also:
Constant Field Values

BLACK

static final int BLACK
Black

See Also:
Constant Field Values

RED

static final int RED
Red

See Also:
Constant Field Values

GREEN

static final int GREEN
Green

See Also:
Constant Field Values

YELLOW

static final int YELLOW
Yellow

See Also:
Constant Field Values

BLUE

static final int BLUE
Blue

See Also:
Constant Field Values

MAGENTA

static final int MAGENTA
Magenta

See Also:
Constant Field Values

CYAN

static final int CYAN
Cyan

See Also:
Constant Field Values

WHITE

static final int WHITE
White

See Also:
Constant Field Values

CRLF

static final java.lang.String CRLF
CRLF (defining carriage+linebreak which is obligation)

See Also:
Constant Field Values
Method Detail

read

int read()
         throws java.io.IOException
Method that retrieves Input from the underlying Stream, translating Terminal specific escape sequences and returning a (constant defined) key, or a character.

Returns:
int that represents a constant defined key.
Throws:
java.io.IOException

write

void write(byte b)
           throws java.io.IOException
Method that writes a raw byte to the terminal.

Parameters:
b - a byte value to be written.
Throws:
java.io.IOException

write

void write(char ch)
           throws java.io.IOException
Method that writes a character to the terminal.

Parameters:
ch - Character that should be written on the screen
Throws:
java.io.IOException

write

void write(java.lang.String str)
           throws java.io.IOException
Method that writes a String to the terminal,

Parameters:
str - String that should be written to the terminal.
Throws:
java.io.IOException

setCursor

void setCursor(int row,
               int col)
               throws java.io.IOException
Method that places the cursor on the terminal on the given absolute position.

Parameters:
row - Integer that represents the desired row coord.
col - Integer that represents the desired column coord.
Throws:
java.io.IOException

moveCursor

void moveCursor(int direction,
                int times)
                throws java.io.IOException
Method that moves the cursor relative from the actual position given times into a given direction.

Parameters:
direction - Constant defined integer.
times - Integer that represents the desired column coord.
Throws:
java.io.IOException

moveRight

void moveRight(int times)
               throws java.io.IOException
Convenience method to move cursor to the right. Wraps moveCursor method.

Parameters:
times - Integer that represents the times the cursor should be moved.
Throws:
java.io.IOException
See Also:
moveCursor(int, int)

moveLeft

void moveLeft(int times)
              throws java.io.IOException
Convenience method to move cursor to the left. Wraps moveCursor method.

Parameters:
times - Integer that represents the times the cursor should be moved.
Throws:
java.io.IOException
See Also:
moveCursor(int, int)

moveUp

void moveUp(int times)
            throws java.io.IOException
Convenience method to move the cursor up. Wraps moveCursor method.

Parameters:
times - Integer that represents the times the cursor should be moved.
Throws:
java.io.IOException
See Also:
moveCursor(int, int)

moveDown

void moveDown(int times)
              throws java.io.IOException
Convenience method to move the cursor down. Wraps moveCursor method.

Parameters:
times - Integer that represents the times the cursor should be moved.
Throws:
java.io.IOException
See Also:
moveCursor(int, int)

homeCursor

void homeCursor()
                throws java.io.IOException
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.

Throws:
java.io.IOException

storeCursor

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

Throws:
java.io.IOException

restoreCursor

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

Throws:
java.io.IOException

eraseToEndOfLine

void eraseToEndOfLine()
                      throws java.io.IOException
Method that erases in the line from the actual cursor position to the end of the line.

Throws:
java.io.IOException

eraseToBeginOfLine

void eraseToBeginOfLine()
                        throws java.io.IOException
Method that erases in the actual line from the actual cursor position to the beginning of the line.

Throws:
java.io.IOException

eraseLine

void eraseLine()
               throws java.io.IOException
Method that erases the entire actual line.

Throws:
java.io.IOException

eraseToEndOfScreen

void eraseToEndOfScreen()
                        throws java.io.IOException
Method that erases in the terminal screen from the actual cursor position to the end of the screen.

Throws:
java.io.IOException

eraseToBeginOfScreen

void eraseToBeginOfScreen()
                          throws java.io.IOException
Method that erases in the terminal screen from the actual cursor postition to the beginning of the screen.

Throws:
java.io.IOException

eraseScreen

void eraseScreen()
                 throws java.io.IOException
Method that erases the entire screen. Note:

Throws:
java.io.IOException

setForegroundColor

void setForegroundColor(int color)
                        throws java.io.IOException
Method that sets the foreground color for writing to the terminal.

Parameters:
color - Integer that represents one of the constant defined colors.
Throws:
java.io.IOException

setBackgroundColor

void setBackgroundColor(int color)
                        throws java.io.IOException
Method that sets the background color for writing on the terminal.

Parameters:
color - Integer that represents one of the constant defined colors.
Throws:
java.io.IOException

setBold

void setBold(boolean b)
             throws java.io.IOException
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.

Parameters:
b - Boolean that flags on/off
Throws:
java.io.IOException

forceBold

void forceBold(boolean b)
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.

Parameters:
b - Boolean that flags on/off

setItalic

void setItalic(boolean b)
               throws java.io.IOException
Method that sets italic as attribute for writing on the terminal. The final representation on the terminal might differ by the terminal type.

Parameters:
b - Boolean that flags on/off
Throws:
java.io.IOException

setUnderlined

void setUnderlined(boolean b)
                   throws java.io.IOException
Method that sets underlined as attribute for writing on the terminal. The final representation on the terminal might differ by the terminal type.

Parameters:
b - Boolean that flags on/off
Throws:
java.io.IOException

setBlink

void setBlink(boolean b)
              throws java.io.IOException
Method that sets blink attribute for writing on the terminal. The final representation on the terminal might differ by the terminal type.

Parameters:
b - Boolean that flags on/off
Throws:
java.io.IOException

resetAttributes

void resetAttributes()
                     throws java.io.IOException
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.

Throws:
java.io.IOException

bell

void bell()
          throws java.io.IOException
Method that sends a signal to the user. This is defined for ANY NVT which is part of the internet protocol standard. The effect on the terminal might differ by the terminal type or telnet client/terminal emulator implementation.

Throws:
java.io.IOException

flush

void flush()
           throws java.io.IOException
Method that ensures all written bytes to be send over the network. If autoflushing is off, this will be necessary to flush buffered data already written.

Throws:
java.io.IOException

close

void close()
           throws java.io.IOException
Closes this BasicTerminalIO.

Throws:
java.io.IOException

setTerminal

void setTerminal(java.lang.String terminalname)
                 throws java.io.IOException
Sets the terminal to be used for this BasicTerminalIO.

Parameters:
terminalname - the name of the terminal.
Throws:
java.io.IOException
See Also:
TerminalManager

setDefaultTerminal

void setDefaultTerminal()
                        throws java.io.IOException
Sets the default terminal.

Throws:
java.io.IOException
See Also:
TerminalManager

getRows

int getRows()
Method to retrieve the actual rows on the clients terminal screen.

Returns:
int that represents the number of rows.

getColumns

int getColumns()
Method to retrieve the actual columns on the clients temrinal screen.

Returns:
int that represents the number of columns.

setSignalling

void setSignalling(boolean b)
Mutator method for the signalling attribute.

Parameters:
b - Boolean that flags on(true) or off(false)

isSignalling

boolean isSignalling()
Accessor method for checking signalling attribute.

Returns:
Boolean that represents if signalling is either turned on(true) or off(false).

setAutoflushing

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

Parameters:
b - Boolean that flags on(true) or off(false)

isAutoflushing

boolean isAutoflushing()
Accessor method for the autoflushing mechanism.

Returns:
Boolean that represents if autoflushing is either turned on(true) or off(false).

resetTerminal

void resetTerminal()
                   throws java.io.IOException
Resets the terminal device.

Throws:
java.io.IOException

setLinewrapping

void setLinewrapping(boolean b)
                     throws java.io.IOException
Sets the linewrapping mode.

Parameters:
b - true if linewrapping on, false otherwise.
Throws:
java.io.IOException

isLineWrapping

boolean isLineWrapping()
                       throws java.io.IOException
Tests if terminal is in linewrapping mode.

Returns:
true if linewrapping, false otherwise.
Throws:
java.io.IOException

defineScrollRegion

boolean defineScrollRegion(int topmargin,
                           int bottommargin)
                           throws java.io.IOException
Allows to define a scroll region. EXPERIMENTAL

Parameters:
topmargin - the top margin in rows.
bottommargin - the bottom margin in rows.
Returns:
true if scrolling supported, false otherwise.
Throws:
java.io.IOException - if an I/O error occurs.


Copyright © 2010. All Rights Reserved.