org.zeroturnaround.exec
Class ProcessResult

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

public class ProcessResult
extends Object

Exit value and output of a finished process.

Author:
Rein Raudjärv
See Also:
ProcessExecutor

Constructor Summary
ProcessResult(int exitCode, ProcessOutput output)
           
 
Method Summary
 int exitValue()
          Deprecated. use getExitValue()
 int getExitValue()
           
 ProcessOutput getOutput()
           
 boolean hasOutput()
           
 byte[] output()
           
 String outputString()
           
 String outputString(String charset)
           
 String outputUTF8()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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. use getExitValue()

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.


Copyright © 2015 ZeroTurnaround. All rights reserved.