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, waitenv, env, exit, exit, interrupt, run, setAgentForwarding, write, write, writeLine, writeLine, x11Forwardexecprotected 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)
IHostExecutorcallback in interface IHostExecutorcallback - 回调方法public void transfer(OutputStream out) throws IOException
IHostExecutortransfer in interface IHostExecutorout - outIOException - IOExceptionpublic void streamHandler(Consumer<InputStream> streamHandler)
IHostExecutorstreamHandler in interface IHostExecutorstreamHandler - 标准输入流处理器public void write(byte[] command)
IHostExecutorwrite in interface IHostExecutorcommand - commandpublic void sendSignal(String signal)
IHostExecutorsendSignal in interface IHostExecutorsignal - 信号protected abstract void listenerOutput()
public void close()
SafeCloseableclose in interface SafeCloseableclose in interface Closeableclose in interface AutoCloseablepublic boolean isDone()
IHostExecutorisDone in interface IHostExecutorpublic InputStream getInputStream()
IHostExecutorgetInputStream in interface IHostExecutorpublic OutputStream getOutputStream()
IHostExecutorgetOutputStream in interface IHostExecutorpublic T getChannel()
Copyright © 2025. All rights reserved.