public class ProcessAwaitExecutor extends BaseProcessExecutor
Modifier and Type | Field and Description |
---|---|
protected Runnable |
callback
执行完毕回调
|
protected ExecutorService |
scheduler
pool
|
addEnv, command, dir, env, redirectError, removeEnv
Constructor and Description |
---|
ProcessAwaitExecutor(String command) |
ProcessAwaitExecutor(String[] command) |
ProcessAwaitExecutor(String[] command,
String dir) |
ProcessAwaitExecutor(String command,
String dir) |
addEnv, addEnv, dir, getAddEnv, getCommand, getDir, getEnv, getTerminalCommand, redirectError, removeEnv, removeEnv, terminal, toString
protected Runnable callback
protected ExecutorService scheduler
public ProcessAwaitExecutor(String command)
public ProcessAwaitExecutor(String[] command)
public ProcessAwaitExecutor inherit()
public ProcessAwaitExecutor waitFor()
public ProcessAwaitExecutor waitFor(long timeout)
timeout
- 超时时间public ProcessAwaitExecutor sync()
public ProcessAwaitExecutor streamHandler(Consumer<InputStream> streamHandler)
streamHandler
- 标准输出流处理器public ProcessAwaitExecutor errorStreamHandler(Consumer<InputStream> errorStreamHandler)
errorStreamHandler
- 错误输出流处理器public ProcessAwaitExecutor scheduler(ExecutorService scheduler)
scheduler
- poolpublic ProcessAwaitExecutor callback(Runnable callback)
callback
- 回调方法public ProcessAwaitExecutor write(String command)
command
- commandpublic ProcessAwaitExecutor writeLine(String command)
command
- commandpublic ProcessAwaitExecutor write(String command, String charset)
command
- commandcharset
- 编码格式public ProcessAwaitExecutor writeLine(String command, String charset)
command
- commandcharset
- 编码格式public ProcessAwaitExecutor write(byte[] command)
command
- commandpublic ProcessAwaitExecutor write(byte[] command, boolean lf)
command
- commandlf
- 是否键入 \npublic ProcessAwaitExecutor interrupt()
public ProcessAwaitExecutor exit()
public void exec()
Executable
public void close()
BaseProcessExecutor
close
in interface SafeCloseable
close
in interface Closeable
close
in interface AutoCloseable
close
in class BaseProcessExecutor
public boolean isAlive()
isAlive
in class BaseProcessExecutor
public int getExitCode()
getExitCode
in class BaseProcessExecutor
public Process getProcess()
BaseProcessExecutor
getProcess
in class BaseProcessExecutor
public ProcessBuilder getProcessBuilder()
BaseProcessExecutor
getProcessBuilder
in class BaseProcessExecutor
public InputStream getInputStream()
public InputStream getErrorStream()
public OutputStream getOutputStream()
public boolean isInherit()
public long getWaitFor()
public boolean isDone()
public boolean isClose()
Copyright © 2024. All rights reserved.