abbot.util
Class ProcessOutputHandler

java.lang.Object
  extended by abbot.util.ProcessOutputHandler

public class ProcessOutputHandler
extends Object

Provides handling of process output/error streams.


Nested Class Summary
static class ProcessOutputHandler.ProcessAbnormalExitException
           
 
Constructor Summary
ProcessOutputHandler()
           
ProcessOutputHandler(Process p)
           
 
Method Summary
static String exec(String[] command)
          Returns the output of the given command as a String.
static String exec(String[] command, String[] environment)
          Returns the output of the given command as a String.
static String exec(String[] command, String[] environment, File dir)
          Returns the output of the given command as a String.
 String getError()
           
protected  void handleError(byte[] buf, int count)
          Override this method to handle stderr output.
protected  void handleOutput(byte[] buf, int count)
          Override this method to handle stdout output.
 void setProcess(Process p)
           
 void waitFor()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProcessOutputHandler

public ProcessOutputHandler()

ProcessOutputHandler

public ProcessOutputHandler(Process p)
Method Detail

getError

public String getError()

setProcess

public void setProcess(Process p)

handleOutput

protected void handleOutput(byte[] buf,
                            int count)
Override this method to handle stdout output. The default implementation does nothing.


handleError

protected void handleError(byte[] buf,
                           int count)
Override this method to handle stderr output. The default implementation does nothing.


waitFor

public void waitFor()
             throws InterruptedException
Throws:
InterruptedException

exec

public static String exec(String[] command)
                   throws IOException
Returns the output of the given command as a String.

Throws:
IOException

exec

public static String exec(String[] command,
                          String[] environment)
                   throws IOException
Returns the output of the given command as a String.

Throws:
IOException

exec

public static String exec(String[] command,
                          String[] environment,
                          File dir)
                   throws IOException
Returns the output of the given command as a String.

Throws:
IOException


Copyright © 2002-2008 Timothy Wall. All Rights Reserved.
Abbot is hosted on

SourceForge