- java.lang.Object
-
- com.aoapps.lang.ProcessResult
-
public class ProcessResult extends Object
Contains the result of executing a process, including return code, standard output, and standard error.- Author:
- AO Industries, Inc.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ProcessResultexec(String... command)Executes the provided command and gets the result in the system default character set.static ProcessResultexec(String[] command, Charset charset)Executes the provided command and gets the result in the provided character set.intgetExitVal()static ProcessResultgetProcessResult(Process process)Gets the result of the provided process in the system default character set.static ProcessResultgetProcessResult(Process process, Charset charset)Gets the result of the provided process in the provided character set.StringgetStderr()StringgetStdout()
-
-
-
Method Detail
-
exec
public static ProcessResult exec(String... command) throws IOException
Executes the provided command and gets the result in the system default character set.- Throws:
IOException
-
exec
public static ProcessResult exec(String[] command, Charset charset) throws IOException
Executes the provided command and gets the result in the provided character set.- Throws:
IOException
-
getProcessResult
public static ProcessResult getProcessResult(Process process) throws IOException
Gets the result of the provided process in the system default character set.- Throws:
IOException
-
getProcessResult
public static ProcessResult getProcessResult(Process process, Charset charset) throws IOException
Gets the result of the provided process in the provided character set.- Throws:
IOException
-
getExitVal
public int getExitVal()
-
getStdout
public String getStdout()
-
getStderr
public String getStderr()
-
-