All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.net.wanmo.common.exec.R Maven / Gradle / Ivy

package cn.net.wanmo.common.exec;

public class R {

    /**
     * waitFor 状态码
     */
    private int waitFor;
    /**
     * 执行的正常输出信息
     */
    private String inputStr;
    /**
     * 执行过程中的警告或错误描述
     */
    private String errorStr;
    /**
     * 执行成功,默认是 -1 不成功, (0 为成功,非0 为不成功)
     */
    private int exitValue = -1;
    /**
     * 异常信息描述
     */
    private String exceptionStr;

    public R() {
    }

    public R(int waitFor, String inputStr, String errorStr) {
        this.waitFor = waitFor;
        this.inputStr = inputStr;
        this.errorStr = errorStr;
    }

    public R(String inputStr, String errorStr, int exitValue) {
        this.inputStr = inputStr;
        this.errorStr = errorStr;
        this.exitValue = exitValue;
    }

    public R(int waitFor, String inputStr, String errorStr, int exitValue) {
        this.waitFor = waitFor;
        this.inputStr = inputStr;
        this.errorStr = errorStr;
        this.exitValue = exitValue;
    }

    public int getWaitFor() {
        return waitFor;
    }

    public void setWaitFor(int waitFor) {
        this.waitFor = waitFor;
    }

    public String getInputStr() {
        return inputStr;
    }

    public void setInputStr(String inputStr) {
        this.inputStr = inputStr;
    }

    public String getErrorStr() {
        return errorStr;
    }

    public void setErrorStr(String errorStr) {
        this.errorStr = errorStr;
    }

    public int getExitValue() {
        return exitValue;
    }

    public void setExitValue(int exitValue) {
        this.exitValue = exitValue;
    }

    public boolean isSuccess() {
        return exitValue == 0;
    }

    public String getExceptionStr() {
        return exceptionStr;
    }

    public void setExceptionStr(String exceptionStr) {
        this.exceptionStr = exceptionStr;
    }

    public String errMsg() {
        String s = "";

        if (exceptionStr != null && exceptionStr.trim().length() > 0) {
            s = exceptionStr;
        }

        if (errorStr != null && errorStr.trim().length() > 0) {
            s = errorStr;
        }

        return s;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy