Package org.wildfly.plugin.common
Class StandardOutput
java.lang.Object
org.wildfly.plugin.common.StandardOutput
Information on how the
stdout
should be consumed.- Author:
- James R. Perkins
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
The target for the the output stream. -
Method Summary
Modifier and TypeMethodDescriptionAn option redirect for thestdout
.The path to the file where the data was written.The target the data was written to.static boolean
static StandardOutput
Parses the string and attempts to determine where the data for the stream should be written.static StandardOutput
Parses the string and attempts to determine where the data for the stream should be written.The following are the options for the value:none
indicates the data for this stream will be consumed andtoString()
will return the data of thediscardNone
parameter isfalse
, otherwise the data will be discardedSystem.out
orSystem.err
to write to the respective stream Any other value is assumed to be the path to a file and the data will written to the filestartConsumer
(Process process) If the processesstdout
should be consumed a thread which consumes it will be started.toString()
-
Method Details
-
parse
Parses the string and attempts to determine where the data for the stream should be written. The following are the options for the value:none
indicates the data for this stream will be consumed andtoString()
will return the data of thediscardNone
parameter isfalse
, otherwise the data will be discardedSystem.out
orSystem.err
to write to the respective stream- Any other value is assumed to be the path to a file and the data will written to the file
- Parameters:
stdout
- the value to be parseddiscardNone
-true
if thestdout
value isnone
and the data should be discarded, otherwise the data will be consumed if thestdout
value isnone
and will be available viatoString()
- Returns:
- a new output stream
- Throws:
IOException
- if there is an error creating the stream
-
parse
public static StandardOutput parse(String stdout, boolean discardNone, boolean append) throws IOException Parses the string and attempts to determine where the data for the stream should be written.The following are the options for the value:none
indicates the data for this stream will be consumed andtoString()
will return the data of thediscardNone
parameter isfalse
, otherwise the data will be discardedSystem.out
orSystem.err
to write to the respective stream- Any other value is assumed to be the path to a file and the data will written to the file
- Parameters:
stdout
- the value to be parseddiscardNone
-true
if thestdout
value isnone
and the data should be discarded, otherwise the data will be consumed if thestdout
value isnone
and will be available viatoString()
append
- If stdout is a file, append output to existing file if true, otherwise a new file is created.- Returns:
- a new output stream
- Throws:
IOException
- if there is an error creating the stream
-
isFile
-
getRedirect
An option redirect for thestdout
.- Returns:
- the optional redirect
-
startConsumer
If the processesstdout
should be consumed a thread which consumes it will be started.- Parameters:
process
- the process to possibly start the thread for- Returns:
- the optional thread
-
getStdoutPath
The path to the file where the data was written.- Returns:
- the path to where the data was written, otherwise
invalid @link
{@link null
-
getTarget
The target the data was written to.- Returns:
- the target
-
toString
-