Class HostIO

java.lang.Object
   |
   +----HostIO

class HostIO
extends Object
HostIO.java wraps TelnetIO to allow line by line reading This is a quick & dirty prototype, but it helps to "get the idea". It uses the Java Telnet implementation from the Java Telnet Applet available at "http://www.first.gmd.de/persons/leo/java/Telnet".


Variable Index

 o CR
 o DC1
 o DEBUG
 o LF
 o LOCAL

Constructor Index

 o HostIO()

Method Index

 o answerTo(String, String)
Convenience method to skip to a given prompt and emulate user input.
 o close()
Closes open telnet connection.
 o getLine()
The most recently parsed line returned by readln().
 o getTerm()
The terminator(s) found when collecting the most recent line.
 o open(String)
Opens telnet connection to give hostname.
 o pushBack()
Set pushBack flag so that next readln() returns same line again.
 o readln()
Read data from telnet connection and parse for line delimiters.
 o skipLines(int)
Convenience method to skip and ignore host output.
 o skipUntilEndsWith(String)
Convenience method to skip scanning for specific line of host output.
 o skipUntilEquals(String)
Convenience method to skip scanning for specific line of host output.
 o skipUntilStartsWith(String)
Convenience method to skip scanning for specific line of host output.
 o writeln(String)
Send a line to the host (with CR+LF) to emulate user input.

Variables

 o DEBUG
 static final boolean DEBUG
 o LOCAL
 static final boolean LOCAL
 o LF
 static final char LF
 o CR
 static final char CR
 o DC1
 static final char DC1

Constructors

 o HostIO
 HostIO()

Methods

 o open
 void open(String hostname) throws IOException
Opens telnet connection to give hostname.

 o close
 void close() throws IOException
Closes open telnet connection.

 o readln
 String readln()
Read data from telnet connection and parse for line delimiters. Accepts CR, LF and CRLF as well as DC1, the latter being typically used as read trigger when host waits for user input. The parsed line terminator is recorded for getTerm() availability.

 o pushBack
 void pushBack()
Set pushBack flag so that next readln() returns same line again.

 o getLine
 String getLine()
The most recently parsed line returned by readln().

 o getTerm
 String getTerm()
The terminator(s) found when collecting the most recent line.

 o writeln
 void writeln(String x)
Send a line to the host (with CR+LF) to emulate user input.

 o skipLines
 void skipLines(int count)
Convenience method to skip and ignore host output.

 o skipUntilEquals
 void skipUntilEquals(String x)
Convenience method to skip scanning for specific line of host output.

 o skipUntilStartsWith
 void skipUntilStartsWith(String x)
Convenience method to skip scanning for specific line of host output.

 o skipUntilEndsWith
 void skipUntilEndsWith(String x)
Convenience method to skip scanning for specific line of host output.

 o answerTo
 void answerTo(String prompt,
               String answer)
Convenience method to skip to a given prompt and emulate user input.