java.lang.Object
com.pnfsoftware.jeb.core.units.code.android.adb.AdbResult

public class AdbResult extends Object
Represent a result from the command adb.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Marker appended by shell commands to signal an ADB execution error.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AdbResult(byte[] output)
    Create an ADB result.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Retrieve the command output bytes.
    Retrieve the command output as a string.
    boolean
    Determine whether the command completed successfully.
    boolean
    isSuccess(Boolean expectOuput)
    Determine whether the command completed successfully.
    boolean
    isSuccess(Boolean expectOuput, boolean verifyGenericErrors, String... knownErrorMessages)
    Unified method to validate that an adb command was executed correctly

    Methods inherited from class java.lang.Object

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

    • ADB_ERROR

      public static final String ADB_ERROR
      Marker appended by shell commands to signal an ADB execution error.
      See Also:
  • Constructor Details

    • AdbResult

      public AdbResult(byte[] output)
      Create an ADB result.
      Parameters:
      output - command output bytes
  • Method Details

    • getOutput

      public byte[] getOutput()
      Retrieve the command output bytes.
      Returns:
      output bytes, or null
    • getOutputString

      public String getOutputString()
      Retrieve the command output as a string.
      Returns:
      decoded output string
    • isSuccess

      public boolean isSuccess()
      Determine whether the command completed successfully.
      Returns:
      true on success
    • isSuccess

      public boolean isSuccess(Boolean expectOuput)
      Determine whether the command completed successfully.
      Parameters:
      expectOuput - expected output presence, or null to ignore
      Returns:
      true on success
    • isSuccess

      public boolean isSuccess(Boolean expectOuput, boolean verifyGenericErrors, String... knownErrorMessages)
      Unified method to validate that an adb command was executed correctly
      Parameters:
      expectOuput - Indicate if there is an expected output stream result. Set null to bypass, true to check that there is an output message, false to check that there is not.
      verifyGenericErrors - Indicate if we should verify some common error messages.
      knownErrorMessages - Specific known error messages raised by this command.
      Returns:
      true on success, false on error