public class ShellExecutor extends BaseHostExecutor<com.jcraft.jsch.ChannelShell> implements IShellExecutor
callback, channel, done, inputStream, outputStream, streamHandler| Constructor and Description |
|---|
ShellExecutor(com.jcraft.jsch.ChannelShell channel) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
安全关闭
|
void |
connect()
建立连接
|
void |
connect(int timeout)
建立连接
使用此方法可能会导致连接不上 但是还不会抛出异常!
|
void |
dpi(int width,
int height)
设置页面 dpi
|
void |
env(byte[] key,
byte[] value)
设置环境变量
这里只支持设置 /etc/ssh/sshd_config AcceptEnv 的环境变量
否则只能使用 export LANG="en_US"; 来设置
|
void |
env(String key,
String value)
设置环境变量
这里只支持设置 /etc/ssh/sshd_config AcceptEnv 的环境变量
否则只能使用 export LANG="en_US"; 来设置
|
void |
exec()
执行
|
int |
getCols()
获取 行字数
|
int |
getHeight()
获取 高px
|
int |
getRows()
获取 列数
|
String |
getTerminalType()
获取设置的终端类型
|
int |
getWidth()
获取 宽px
|
protected void |
listenerOutput()
监听 标准输出/错误输出
|
void |
resize()
告知服务器重新设置终端大小
|
void |
setAgentForwarding(boolean enable)
启用代理转发
|
void |
size(int cols,
int rows)
设置页面大小
|
void |
size(int cols,
int rows,
int width,
int height)
设置页面大小
|
void |
terminalType(String terminalType)
设置终端类型
|
void |
x11Forward(boolean enable)
是否启用 x11forwarding
|
callback, getChannel, getInputStream, getOutputStream, isDone, sendSignal, streamHandler, transfer, writeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitterminalTypecallback, exit, exit, getInputStream, getOutputStream, interrupt, isDone, run, sendSignal, streamHandler, transfer, write, write, write, writeLine, writeLinedisconnect, disconnectChannel, disconnectSession, getChannel, getSession, isClosed, isConnected, isEofpublic void x11Forward(boolean enable)
IHostExecutorx11Forward in interface IHostExecutorenable - 是否启用public void setAgentForwarding(boolean enable)
IHostExecutorsetAgentForwarding in interface IHostExecutorenable - 是否启用public void terminalType(String terminalType)
IShellExecutorterminalType in interface IShellExecutorterminalType - terminalTypepublic void size(int cols,
int rows)
IShellExecutorsize in interface IShellExecutorcols - 行字数rows - 列数public void dpi(int width,
int height)
IShellExecutordpi in interface IShellExecutorwidth - 宽pxheight - 高pxpublic void size(int cols,
int rows,
int width,
int height)
IShellExecutorsize in interface IShellExecutorcols - 行字数rows - 列数width - 宽pxheight - 高pxpublic void resize()
IShellExecutorresize in interface IShellExecutorpublic void connect()
HostConnectorconnect in interface HostConnectorpublic void connect(int timeout)
HostConnectorChannel.sendChannelOpen() 的 retry 设置为 1connect in interface HostConnectortimeout - 超时时间 mspublic void env(byte[] key,
byte[] value)
IHostExecutorenv in interface IHostExecutorkey - keyvalue - valuepublic void env(String key, String value)
IHostExecutorenv in interface IHostExecutorkey - keyvalue - valueprotected void listenerOutput()
BaseHostExecutorlistenerOutput in class BaseHostExecutor<com.jcraft.jsch.ChannelShell>public void exec()
Executableexec in interface Executablepublic void close()
SafeCloseableclose in interface SafeCloseableclose in interface Closeableclose in interface AutoCloseableclose in class BaseHostExecutor<com.jcraft.jsch.ChannelShell>public String getTerminalType()
IShellExecutorgetTerminalType in interface IShellExecutorpublic int getCols()
IShellExecutorgetCols in interface IShellExecutorpublic int getRows()
IShellExecutorgetRows in interface IShellExecutorpublic int getWidth()
IShellExecutorgetWidth in interface IShellExecutorpublic int getHeight()
IShellExecutorgetHeight in interface IShellExecutorCopyright © 2025. All rights reserved.