org.schmant.support.io
Class SaveToStringProcessOutputStrategy

java.lang.Object
  extended by org.schmant.support.io.SaveToStringProcessOutputStrategy
All Implemented Interfaces:
ProcessOutputStrategy

public class SaveToStringProcessOutputStrategy
extends Object
implements ProcessOutputStrategy

This ProcessOutputStrategy saves the output from the process to a string. The getOutput() method can be used to retrieve the output after the process has terminated.

Since:
0.5
Author:
Karl Gustafsson

Constructor Summary
SaveToStringProcessOutputStrategy()
          Create a save-to-String process output strategy.
SaveToStringProcessOutputStrategy(long pollInterval)
          Create a save-to-String process output strategy.
 
Method Summary
 String getOutput()
          Get the output from the process after it has been run.
 ProcessOutputListener getOutputListener()
          Create a new process output listener for listening to a process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SaveToStringProcessOutputStrategy

public SaveToStringProcessOutputStrategy()
Create a save-to-String process output strategy. It will poll the monitored process with the standard polling interval (see AbstractProcessOutputListener).


SaveToStringProcessOutputStrategy

public SaveToStringProcessOutputStrategy(long pollInterval)
Create a save-to-String process output strategy. It will poll the monitored process with the supplied polling interval.

Parameters:
pollInterval - The polling interval in milliseconds.
Method Detail

getOutputListener

public ProcessOutputListener getOutputListener()
Description copied from interface: ProcessOutputStrategy
Create a new process output listener for listening to a process.

Specified by:
getOutputListener in interface ProcessOutputStrategy
Returns:
A new process output listener.

getOutput

public String getOutput()
Get the output from the process after it has been run.

Returns:
The output.