com.sshtools.j2ssh.session
Class SessionOutputReader
java.lang.Object
com.sshtools.j2ssh.session.SessionOutputReader
public class SessionOutputReader
extends java.lang.Object
This class provides a utility to read and parse the output a session,
providing methods to wait for specific strings such as the prompt or
command input requests.
SessionOutputReader
public SessionOutputReader(SessionChannelClient session)
Contructs the session reader.
echoLineByLineToClose
public void echoLineByLineToClose(SessionOutputEcho echo)
throws InterruptedException
getMarkedOutput
public String getMarkedOutput()
Returns a string containing the session output from the current marked
position to the end of the output.
- a string containing the session output from the marked position
to current position
getOutput
public String getOutput()
Returns the output of the entire session.
- a string containing the entire output of the session so far.
getPosition
public int getPosition()
Returns the current position of the session input pointer. This pointer
is set to the position of the matched string everytime a match is found
during a call by waitForString
- the current input reader pointer
markCurrentPosition
public void markCurrentPosition()
Marks the current position.
markPosition
public void markPosition(int mark)
Mark the postion specified for filtering session output.
mark
- output position to mark
waitForString
public boolean waitForString(String str)
throws InterruptedException
Wait for a given String in the output buffer. This method will block
until the string is found.
str
- the string to wait for
- true if the string was found, otherwise false
waitForString(String, int, SessionOutputEcho)
waitForString
public boolean waitForString(String str,
SessionOutputEcho echo)
throws InterruptedException
Wait for a given String in the output buffer.
str
- the string to wait forecho
- a callback interface to receive the session output whilst
the no match for the string is found
- true if the string was found, otherwise false
waitForString(String, int, SessionOutputEcho)
waitForString
public boolean waitForString(String str,
int timeout)
throws InterruptedException
Wait for a given String in the output buffer.
str
- the string to wait fortimeout
- the number of milliseconds to wait
- true if the string was found, otherwise false
waitForString(String, int, SessionOutputEcho)
waitForString
public boolean waitForString(String str,
int timeout,
SessionOutputEcho echo)
throws InterruptedException
Wait for a given String in the output buffer. When this method is called
the method will block unitil either the String arrives in the input
buffer or the timeout specified has elasped.
str
- the string to wait fortimeout
- the number of milliseconds to wait, 0=infiniteecho
- a callback interface to receive the session output whilst
the no match for the string is found
- true if the string was found, otherwise false
Copyright © 2002-2003 Lee David Painter & Contributors. All Rights Reserved.