public abstract class BaseHostExecutor<T extends com.jcraft.jsch.Channel> extends Object implements IHostExecutor
Modifier and Type | Field and Description |
---|---|
protected Runnable |
callback
执行完毕回调
|
protected T |
channel |
protected boolean |
done
是否执行完毕
|
protected InputStream |
inputStream
标准输出流
|
protected OutputStream |
outputStream
标准输入流
|
protected Consumer<InputStream> |
streamHandler
标准输出流处理器
|
Constructor and Description |
---|
BaseHostExecutor(T channel) |
Modifier and Type | Method and Description |
---|---|
void |
callback(Runnable callback)
异步完成回调
|
void |
close()
安全关闭
|
T |
getChannel() |
InputStream |
getInputStream()
获取标准输出流
|
OutputStream |
getOutputStream()
获取标准输入流
|
boolean |
isDone()
是否执行完成
|
protected abstract void |
listenerOutput()
监听 标准输出/错误输出
|
void |
sendSignal(String signal)
发送信号量
|
void |
streamHandler(Consumer<InputStream> streamHandler)
设置标准输出流处理器
|
void |
transfer(OutputStream out)
传输标准输出流到指定输出流
|
void |
write(byte[] command)
写入命令
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
env, env, exit, exit, interrupt, run, setAgentForwarding, write, write, writeLine, writeLine, x11Forward
exec
protected final T extends com.jcraft.jsch.Channel channel
protected InputStream inputStream
protected OutputStream outputStream
protected Consumer<InputStream> streamHandler
protected Runnable callback
protected volatile boolean done
public BaseHostExecutor(T channel)
public void callback(Runnable callback)
IHostExecutor
callback
in interface IHostExecutor
callback
- 回调方法public void transfer(OutputStream out) throws IOException
IHostExecutor
transfer
in interface IHostExecutor
out
- outIOException
- IOExceptionpublic void streamHandler(Consumer<InputStream> streamHandler)
IHostExecutor
streamHandler
in interface IHostExecutor
streamHandler
- 标准输入流处理器public void write(byte[] command)
IHostExecutor
write
in interface IHostExecutor
command
- commandpublic void sendSignal(String signal)
IHostExecutor
sendSignal
in interface IHostExecutor
signal
- 信号protected abstract void listenerOutput()
public void close()
SafeCloseable
close
in interface SafeCloseable
close
in interface Closeable
close
in interface AutoCloseable
public boolean isDone()
IHostExecutor
isDone
in interface IHostExecutor
public InputStream getInputStream()
IHostExecutor
getInputStream
in interface IHostExecutor
public OutputStream getOutputStream()
IHostExecutor
getOutputStream
in interface IHostExecutor
public T getChannel()
Copyright © 2024. All rights reserved.