Save This Page
Home » j2ssh-0.2.9-src » com.sshtools.j2ssh.session » [javadoc | source]
com.sshtools.j2ssh.session
public class: SessionOutputReader [javadoc | source]
java.lang.Object
   com.sshtools.j2ssh.session.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:
class  SessionOutputReader.SessionOutputListener  The ChannelEventListener to receive event notifications 
Field Summary
 SessionChannelClient session     
 int pos     
 int mark     
 String output     
Constructor:
 public SessionOutputReader(SessionChannelClient session) 

    Contructs the session reader.

    Parameters:
    session - the to read
Method from com.sshtools.j2ssh.session.SessionOutputReader Summary:
echoLineByLineToClose,   getMarkedOutput,   getOutput,   getPosition,   markCurrentPosition,   markPosition,   waitForString,   waitForString,   waitForString,   waitForString
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.sshtools.j2ssh.session.SessionOutputReader Detail:
 public synchronized  void echoLineByLineToClose(SessionOutputEcho echo) throws InterruptedException 
 public String getMarkedOutput() 

    Returns a string containing the session output from the current marked position to the end of the output.

 public String getOutput() 
    Returns the output of the entire session.
 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 markCurrentPosition() 
    Marks the current position.
 public  void markPosition(int mark) 
    Mark the postion specified for filtering session output.
 public synchronized boolean waitForString(String str) throws InterruptedException 

    Wait for a given String in the output buffer. This method will block until the string is found.

 public synchronized boolean waitForString(String str,
    SessionOutputEcho echo) throws InterruptedException 

    Wait for a given String in the output buffer.

 public synchronized boolean waitForString(String str,
    int timeout) throws InterruptedException 

    Wait for a given String in the output buffer.

 public synchronized 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.