类 ExecuteCmdUtil
java.lang.Object
tech.mhuang.pacebox.core.util.ExecuteCmdUtil
执行cmd命令工具
- 从以下版本开始:
- 1.0.9
- 作者:
- yuanhang.huang
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static voidcheckPrintNotFound(String print) 检查命令输出的打印中是否有not foundstatic ProcessexecuteCmdProcess(String cmd) 执行命令,返回执行的线程static booleanexecuteCmdSingle(String cmd) 执行简单的命令static String执行线程输出的错误信息static voidprocessInput(Process ps, String input) 向执行线程中输入信息static StringprocessOutput(Process ps) 执行线程输出的信息static boolean等待执行线程完毕并返回状态static boolean等待执行线程完毕并返回状态,执行失败自动关闭线程
-
字段详细资料
-
构造器详细资料
-
ExecuteCmdUtil
public ExecuteCmdUtil()
-
-
方法详细资料
-
executeCmdSingle
执行简单的命令- 参数:
cmd- 命令- 返回:
- 是否执行成功
- 抛出:
IOException- IOExceptionInterruptedException- InterruptedException
-
executeCmdProcess
执行命令,返回执行的线程- 参数:
cmd- 命令- 返回:
- Process
- 抛出:
IOException- IOException
-
processOutput
执行线程输出的信息- 参数:
ps- 执行线程- 返回:
- String 线程输出的信息
- 抛出:
IOException- IOException
-
processErrOutput
执行线程输出的错误信息- 参数:
ps- 执行线程- 返回:
- String 线程输出的错误信息
- 抛出:
IOException- IOException
-
processInput
向执行线程中输入信息- 参数:
ps- 执行线程input- 输入命令- 抛出:
IOException- IOException
-
processWaitForAndDestroy
等待执行线程完毕并返回状态,执行失败自动关闭线程- 参数:
ps- 执行线程- 返回:
- 线程执行是否成功
- 抛出:
InterruptedException- InterruptedException
-
processWaitFor
等待执行线程完毕并返回状态- 参数:
ps- 执行线程- 返回:
- 线程执行是否成功
- 抛出:
InterruptedException- InterruptedException
-
checkPrintNotFound
检查命令输出的打印中是否有not found- 参数:
print- 字符串
-