|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sshtools.j2ssh.session.SessionOutputReader
public class SessionOutputReader
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.
Nested Class Summary | |
---|---|
(package private) class |
SessionOutputReader.SessionOutputListener
The ChannelEventListener to receive event notifications |
Field Summary | |
---|---|
(package private) int |
mark
|
(package private) java.lang.String |
output
|
(package private) int |
pos
|
(package private) SessionChannelClient |
session
|
Constructor Summary | |
---|---|
SessionOutputReader(SessionChannelClient session)
Contructs the session reader. |
Method Summary | |
---|---|
private void |
breakWaiting()
|
void |
echoLineByLineToClose(SessionOutputEcho echo)
|
java.lang.String |
getMarkedOutput()
Returns a string containing the session output from the current marked position to the end of the output. |
java.lang.String |
getOutput()
Returns the output of the entire session. |
int |
getPosition()
Returns the current position of the session input pointer. |
void |
markCurrentPosition()
Marks the current position. |
void |
markPosition(int mark)
Mark the postion specified for filtering session output. |
boolean |
waitForString(java.lang.String str)
Wait for a given String in the output buffer. |
boolean |
waitForString(java.lang.String str,
int timeout)
Wait for a given String in the output buffer. |
boolean |
waitForString(java.lang.String str,
int timeout,
SessionOutputEcho echo)
Wait for a given String in the output buffer. |
boolean |
waitForString(java.lang.String str,
SessionOutputEcho echo)
Wait for a given String in the output buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
SessionChannelClient session
int pos
int mark
java.lang.String output
Constructor Detail |
---|
public SessionOutputReader(SessionChannelClient session)
Contructs the session reader.
session
- the to readMethod Detail |
---|
public java.lang.String getOutput()
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
public void markPosition(int mark)
mark
- output position to markpublic void markCurrentPosition()
public java.lang.String getMarkedOutput()
Returns a string containing the session output from the current marked position to the end of the output.
public boolean waitForString(java.lang.String str, SessionOutputEcho echo) throws java.lang.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
java.lang.InterruptedException
- if the thread is interruptedwaitForString(String, int, SessionOutputEcho)
public boolean waitForString(java.lang.String str) throws java.lang.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
java.lang.InterruptedException
- if the thread is interruptedwaitForString(String, int, SessionOutputEcho)
public boolean waitForString(java.lang.String str, int timeout) throws java.lang.InterruptedException
Wait for a given String in the output buffer.
str
- the string to wait fortimeout
- the number of milliseconds to wait
java.lang.InterruptedException
- if the thread is interruptedwaitForString(String, int, SessionOutputEcho)
public boolean waitForString(java.lang.String str, int timeout, SessionOutputEcho echo) throws java.lang.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
java.lang.InterruptedException
- if the thread is interruptedpublic void echoLineByLineToClose(SessionOutputEcho echo) throws java.lang.InterruptedException
echo
-
java.lang.InterruptedException
private void breakWaiting()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |