Class ProcessResult

java.lang.Object
org.zeroturnaround.exec.ProcessResult

public class ProcessResult extends Object
Exit value and output of a finished process.
See Also:
  • Field Details

    • exitValue

      private final int exitValue
      Exit value of the finished process.
    • output

      private final ProcessOutput output
      Process output or null if it wasn't read.
  • Constructor Details

    • ProcessResult

      public ProcessResult(int exitCode, ProcessOutput output)
  • Method Details

    • getExitValue

      public int getExitValue()
      Returns:
      the exit value of the finished process.
    • exitValue

      public int exitValue()
      Deprecated.
      Returns:
      the exit value of the finished process.
    • hasOutput

      public boolean hasOutput()
      Returns:
      true if the process output was read.
    • getOutput

      public ProcessOutput getOutput()
      Returns:
      output of the finished process. You have to invoke ProcessExecutor.readOutput(boolean) to set the process output to be read.
      Throws:
      IllegalStateException - if the output was not read.
    • output

      public byte[] output()
      Returns:
      binary output of the finished process. You have to invoke ProcessExecutor.readOutput(boolean) to set the process output to be read.
      Throws:
      IllegalStateException - if the output was not read.
    • outputString

      public String outputString()
      Returns:
      output of the finished process converted to a String using platform's default encoding. You have to invoke ProcessExecutor.readOutput(boolean) to set the process output to be read.
      Throws:
      IllegalStateException - if the output was not read.
    • outputUTF8

      public String outputUTF8()
      Returns:
      output of the finished process converted to UTF-8 String. You have to invoke ProcessExecutor.readOutput(boolean) to set the process output to be read.
      Throws:
      IllegalStateException - if the output was not read.
    • outputString

      public String outputString(String charset)
      Parameters:
      charset - The name of a supported char set.
      Returns:
      output of the finished process converted to a String. You have to invoke ProcessExecutor.readOutput(boolean) to set the process output to be read.
      Throws:
      IllegalStateException - if the output was not read or the char set was not supported.