Class CollectingProcessOutput
- java.lang.Object
-
- com.github.fracpete.processoutput4j.output.AbstractProcessOutput
-
- com.github.fracpete.processoutput4j.output.CollectingProcessOutput
-
- All Implemented Interfaces:
java.io.Serializable
public final class CollectingProcessOutput extends AbstractProcessOutput
Collects the process output (stdout and stderr) and makes them available once the process finishes.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringBuilderm_StdErrthe stderr content.protected java.lang.StringBuilderm_StdOutthe stdout content.-
Fields inherited from class com.github.fracpete.processoutput4j.output.AbstractProcessOutput
m_Command, m_Environment, m_ExitCode, m_Process, m_ReaderStdErr, m_ReaderStdOut, m_RunnableTimeout, m_TimedOut, m_TimeOut
-
-
Constructor Summary
Constructors Constructor Description CollectingProcessOutput()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AbstractProcessReaderconfigureStdErr()Configures the reader for stderr.protected AbstractProcessReaderconfigureStdOut()Configures the reader for stdout.java.lang.StringgetStdErr()Returns the output on stderr.java.lang.StringgetStdOut()Returns the output on stdout.protected voidinitialize()For initializing the members.static voidmain(java.lang.String[] args)Allows the execution of a command through this process output scheme.-
Methods inherited from class com.github.fracpete.processoutput4j.output.AbstractProcessOutput
configureTimeOutMonitor, destroy, flush, getCommand, getEnvironment, getExitCode, getProcess, getTimeOut, hasSucceeded, hasTimedOut, monitor, monitor, monitor, monitor, monitor, setTimeOut, toString
-
-
-
-
Method Detail
-
initialize
protected void initialize()
For initializing the members.- Overrides:
initializein classAbstractProcessOutput
-
configureStdErr
protected AbstractProcessReader configureStdErr()
Configures the reader for stderr.- Specified by:
configureStdErrin classAbstractProcessOutput- Returns:
- the configured reader
-
configureStdOut
protected AbstractProcessReader configureStdOut()
Configures the reader for stdout.- Specified by:
configureStdOutin classAbstractProcessOutput- Parameters:
process- the process to monitor- Returns:
- the configured reader
-
getStdOut
public java.lang.String getStdOut()
Returns the output on stdout.- Returns:
- the output
-
getStdErr
public java.lang.String getStdErr()
Returns the output on stderr.- Returns:
- the output
-
main
public static void main(java.lang.String[] args) throws java.lang.ExceptionAllows the execution of a command through this process output scheme.- Parameters:
args- the command to launch- Throws:
java.lang.Exception- if launching fails for some reason
-
-