Package org.wildfly.plugin.common

## Class StandardOutput

- java.lang.Object
- - org.wildfly.plugin.common.StandardOutput

-     public class StandardOutput
      extends Object

  Information on how the `stdout` should be consumed.
  Author:
    James R. Perkins

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `StandardOutput.Target` | The target for the the output stream.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Optional<ProcessBuilder.Redirect>` | `getRedirect()` | An option redirect for the `stdout`.
    `Path` | `getStdoutPath()` | The path to the file where the data was written.
    `StandardOutput.Target` | `getTarget()` | The target the data was written to.
    `static boolean` | `isFile​(String output)` |
    `static StandardOutput` | `parse​(String stdout, boolean discardNone)` | Parses the string and attempts to determine where the data for the stream should be written.
    `static StandardOutput` | `parse​(String stdout, boolean discardNone, boolean append)` | 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 and `toString()` will return the data of the `discardNone` parameter is `false`, otherwise the data will be discarded `System.out` or `System.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
    `Optional<Thread>` | `startConsumer​(Process process)` | If the processes `stdout` should be consumed a thread which consumes it will be started.
    `String` | `toString()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### parse

          public static StandardOutput parse​(String stdout,
                                             boolean discardNone)
                                      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 and `toString()` will return the data of the `discardNone` parameter is `false`, otherwise the data will be discarded
      - `System.out` or `System.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 parsed
        `discardNone` - `true` if the `stdout` value is `none` and the data should be discarded, otherwise the data will be consumed if the `stdout` value is `none` and will be available via `toString()`
      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 and `toString()` will return the data of the `discardNone` parameter is `false`, otherwise the data will be discarded
      - `System.out` or `System.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 parsed
        `discardNone` - `true` if the `stdout` value is `none` and the data should be discarded, otherwise the data will be consumed if the `stdout` value is `none` and will be available via `toString()`
        `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

          public static boolean isFile​(String output)

    - #### getRedirect

          public Optional<ProcessBuilder.Redirect> getRedirect()

      An option redirect for the `stdout`.
      Returns:
        the optional redirect

    - #### startConsumer

          public Optional<Thread> startConsumer​(Process process)

      If the processes `stdout` 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

          public Path getStdoutPath()

      The path to the file where the data was written.
      Returns:
        the path to where the data was written, otherwise {@link null} if the data was not written to a file.

    - #### getTarget

          public StandardOutput.Target getTarget()

      The target the data was written to.
      Returns:
        the target

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`