Class Shell.Result

java.lang.Object
com.topjohnwu.superuser.Shell.Result
Enclosing class:
Shell

public abstract static class Shell.Result extends Object
The result of a Shell.Job.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    This code indicates that the job was not executed, and the outputs are all empty.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract int
    Get the return code of the job.
    abstract List<String>
    Get the output of STDERR.
    abstract List<String>
    Get the output of STDOUT.
    boolean
    Whether the job succeeded.

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • JOB_NOT_EXECUTED

      public static final int JOB_NOT_EXECUTED
      This code indicates that the job was not executed, and the outputs are all empty. Constant value: -1.
      See Also:
  • Constructor Details

    • Result

      public Result()
  • Method Details

    • getOut

      @NonNull public abstract List<String> getOut()
      Get the output of STDOUT.
      Returns:
      a list of strings that stores the output of STDOUT. Empty list if no output is available.
    • getErr

      @NonNull public abstract List<String> getErr()
      Get the output of STDERR.
      Returns:
      a list of strings that stores the output of STDERR. Empty list if no output is available.
    • getCode

      public abstract int getCode()
      Get the return code of the job.
      Returns:
      the return code of the last operation in the shell. If the job is executed properly, the code should range from 0-255. If the job fails to execute, it will return JOB_NOT_EXECUTED.
    • isSuccess

      public boolean isSuccess()
      Whether the job succeeded. getCode() == 0.
      Returns:
      true if the return code is 0.