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".
-
CR
-
-
DC1
-
-
DEBUG
-
-
LF
-
-
LOCAL
-
-
HostIO()
-
-
answerTo(String, String)
- Convenience method to skip to a given prompt and emulate user input.
-
close()
- Closes open telnet connection.
-
getLine()
- The most recently parsed line returned by readln().
-
getTerm()
- The terminator(s) found when collecting the most recent line.
-
open(String)
- Opens telnet connection to give hostname.
-
pushBack()
- Set pushBack flag so that next readln() returns same line again.
-
readln()
- Read data from telnet connection and parse for line delimiters.
-
skipLines(int)
- Convenience method to skip and ignore host output.
-
skipUntilEndsWith(String)
- Convenience method to skip scanning for specific line of host output.
-
skipUntilEquals(String)
- Convenience method to skip scanning for specific line of host output.
-
skipUntilStartsWith(String)
- Convenience method to skip scanning for specific line of host output.
-
writeln(String)
- Send a line to the host (with CR+LF) to emulate user input.
DEBUG
static final boolean DEBUG
LOCAL
static final boolean LOCAL
LF
static final char LF
CR
static final char CR
DC1
static final char DC1
HostIO
HostIO()
open
void open(String hostname) throws IOException
- Opens telnet connection to give hostname.
close
void close() throws IOException
- Closes open telnet connection.
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.
pushBack
void pushBack()
- Set pushBack flag so that next readln() returns same line again.
getLine
String getLine()
- The most recently parsed line returned by readln().
getTerm
String getTerm()
- The terminator(s) found when collecting the most recent line.
writeln
void writeln(String x)
- Send a line to the host (with CR+LF) to emulate user input.
skipLines
void skipLines(int count)
- Convenience method to skip and ignore host output.
skipUntilEquals
void skipUntilEquals(String x)
- Convenience method to skip scanning for specific line of host output.
skipUntilStartsWith
void skipUntilStartsWith(String x)
- Convenience method to skip scanning for specific line of host output.
skipUntilEndsWith
void skipUntilEndsWith(String x)
- Convenience method to skip scanning for specific line of host output.
answerTo
void answerTo(String prompt,
String answer)
- Convenience method to skip to a given prompt and emulate user input.