Class CollectingProcessOutput

java.lang.Object
com.github.fracpete.processoutput4j.output.AbstractProcessOutput
com.github.fracpete.processoutput4j.output.CollectingProcessOutput
All Implemented Interfaces:
Serializable

public final class CollectingProcessOutput extends AbstractProcessOutput
Collects the process output (stdout and stderr) and makes them available once the process finishes.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      for serialization.
      See Also:
    • m_StdOut

      protected StringBuilder m_StdOut
      the stdout content.
    • m_StdErr

      protected StringBuilder m_StdErr
      the stderr content.
  • Constructor Details

    • CollectingProcessOutput

      public CollectingProcessOutput()
  • Method Details

    • initialize

      protected void initialize()
      For initializing the members.
      Overrides:
      initialize in class AbstractProcessOutput
    • configureStdErr

      protected AbstractProcessReader configureStdErr()
      Configures the reader for stderr.
      Specified by:
      configureStdErr in class AbstractProcessOutput
      Returns:
      the configured reader
    • configureStdOut

      protected AbstractProcessReader configureStdOut()
      Configures the reader for stdout.
      Specified by:
      configureStdOut in class AbstractProcessOutput
      Parameters:
      process - the process to monitor
      Returns:
      the configured reader
    • getStdOut

      public String getStdOut()
      Returns the output on stdout.
      Returns:
      the output
    • getStdErr

      public String getStdErr()
      Returns the output on stderr.
      Returns:
      the output
    • main

      public static void main(String[] args) throws Exception
      Allows the execution of a command through this process output scheme.
      Parameters:
      args - the command to launch
      Throws:
      Exception - if launching fails for some reason