Class PrefixedStreamingProcessOwner
- java.lang.Object
-
- com.github.fracpete.processoutput4j.core.impl.PrefixedStreamingProcessOwner
-
- All Implemented Interfaces:
StreamingProcessOwner
public class PrefixedStreamingProcessOwner extends java.lang.Object implements StreamingProcessOwner
Simple class for streaming a process's stdout/stderr to this stdout, but prefixing each line with the appropriate stdout/stderr prefix.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_PREFIX_STDERRdefault prefix for stderr.static java.lang.StringDEFAULT_PREFIX_STDOUTdefault prefix for stdout.protected java.lang.Stringm_PrefixStdErrthe prefix for stderr.protected java.lang.Stringm_PrefixStdOutthe prefix for stdout.
-
Constructor Summary
Constructors Constructor Description PrefixedStreamingProcessOwner()Initializes the output using the default prefixes.PrefixedStreamingProcessOwner(java.lang.String prefixStdOut, java.lang.String prefixStdErr)Initializes the output using the specified prefixes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StreamingProcessOutputTypegetOutputType()Returns what output from the process to forward.voidprocessOutput(java.lang.String line, boolean stdout)Processes the incoming line.
-
-
-
Field Detail
-
DEFAULT_PREFIX_STDOUT
public static final java.lang.String DEFAULT_PREFIX_STDOUT
default prefix for stdout.- See Also:
- Constant Field Values
-
DEFAULT_PREFIX_STDERR
public static final java.lang.String DEFAULT_PREFIX_STDERR
default prefix for stderr.- See Also:
- Constant Field Values
-
m_PrefixStdOut
protected java.lang.String m_PrefixStdOut
the prefix for stdout.
-
m_PrefixStdErr
protected java.lang.String m_PrefixStdErr
the prefix for stderr.
-
-
Constructor Detail
-
PrefixedStreamingProcessOwner
public PrefixedStreamingProcessOwner()
Initializes the output using the default prefixes.- See Also:
DEFAULT_PREFIX_STDOUT,DEFAULT_PREFIX_STDERR
-
PrefixedStreamingProcessOwner
public PrefixedStreamingProcessOwner(java.lang.String prefixStdOut, java.lang.String prefixStdErr)Initializes the output using the specified prefixes.- Parameters:
prefixStdOut- the prefix for stdoutprefixStdErr- the prefix for stderr
-
-
Method Detail
-
getOutputType
public StreamingProcessOutputType getOutputType()
Returns what output from the process to forward.- Specified by:
getOutputTypein interfaceStreamingProcessOwner- Returns:
- StreamingProcessOutputType#BOTH
-
processOutput
public void processOutput(java.lang.String line, boolean stdout)Processes the incoming line.- Specified by:
processOutputin interfaceStreamingProcessOwner- Parameters:
line- the line to processstdout- whether stdout or stderr
-
-