Class ProcessResult


  • public class ProcessResult
    extends java.lang.Object
    Exit value and output of a finished process.
    See Also:
    ProcessExecutor
    • Field Detail

      • 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 Detail

      • ProcessResult

        public ProcessResult​(int exitCode,
                             ProcessOutput output)
    • Method Detail

      • 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:
        java.lang.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:
        java.lang.IllegalStateException - if the output was not read.
      • outputString

        public java.lang.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:
        java.lang.IllegalStateException - if the output was not read.
      • outputUTF8

        public java.lang.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:
        java.lang.IllegalStateException - if the output was not read.
      • outputString

        public java.lang.String outputString​(java.lang.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:
        java.lang.IllegalStateException - if the output was not read or the char set was not supported.