Package org.zeroturnaround.exec
Class ProcessResult
- java.lang.Object
-
- org.zeroturnaround.exec.ProcessResult
-
public class ProcessResult extends java.lang.Object
Exit value and output of a finished process.- See Also:
ProcessExecutor
-
-
Field Summary
Fields Modifier and Type Field Description private int
exitValue
Exit value of the finished process.private ProcessOutput
output
Process output ornull
if it wasn't read.
-
Constructor Summary
Constructors Constructor Description ProcessResult(int exitCode, ProcessOutput output)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
exitValue()
Deprecated.usegetExitValue()
int
getExitValue()
ProcessOutput
getOutput()
boolean
hasOutput()
byte[]
output()
java.lang.String
outputString()
java.lang.String
outputString(java.lang.String charset)
java.lang.String
outputUTF8()
-
-
-
Field Detail
-
exitValue
private final int exitValue
Exit value of the finished process.
-
output
private final ProcessOutput output
Process output ornull
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.usegetExitValue()
- 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.
-
-