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, write
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
terminalType
callback, exit, exit, getInputStream, getOutputStream, interrupt, isDone, run, sendSignal, streamHandler, transfer, write, write, write, writeLine, writeLine
disconnect, disconnectChannel, disconnectSession, getChannel, getSession, isClosed, isConnected, isEof
public void x11Forward(boolean enable)
IHostExecutor
x11Forward
in interface IHostExecutor
enable
- 是否启用public void setAgentForwarding(boolean enable)
IHostExecutor
setAgentForwarding
in interface IHostExecutor
enable
- 是否启用public void terminalType(String terminalType)
IShellExecutor
terminalType
in interface IShellExecutor
terminalType
- terminalTypepublic void size(int cols, int rows)
IShellExecutor
size
in interface IShellExecutor
cols
- 行字数rows
- 列数public void dpi(int width, int height)
IShellExecutor
dpi
in interface IShellExecutor
width
- 宽pxheight
- 高pxpublic void size(int cols, int rows, int width, int height)
IShellExecutor
size
in interface IShellExecutor
cols
- 行字数rows
- 列数width
- 宽pxheight
- 高pxpublic void resize()
IShellExecutor
resize
in interface IShellExecutor
public void connect()
HostConnector
connect
in interface HostConnector
public void connect(int timeout)
HostConnector
Channel.sendChannelOpen()
的 retry 设置为 1connect
in interface HostConnector
timeout
- 超时时间 mspublic void env(byte[] key, byte[] value)
IHostExecutor
env
in interface IHostExecutor
key
- keyvalue
- valuepublic void env(String key, String value)
IHostExecutor
env
in interface IHostExecutor
key
- keyvalue
- valueprotected void listenerOutput()
BaseHostExecutor
listenerOutput
in class BaseHostExecutor<com.jcraft.jsch.ChannelShell>
public void exec()
Executable
exec
in interface Executable
public void close()
SafeCloseable
close
in interface SafeCloseable
close
in interface Closeable
close
in interface AutoCloseable
close
in class BaseHostExecutor<com.jcraft.jsch.ChannelShell>
public String getTerminalType()
IShellExecutor
getTerminalType
in interface IShellExecutor
public int getCols()
IShellExecutor
getCols
in interface IShellExecutor
public int getRows()
IShellExecutor
getRows
in interface IShellExecutor
public int getWidth()
IShellExecutor
getWidth
in interface IShellExecutor
public int getHeight()
IShellExecutor
getHeight
in interface IShellExecutor
Copyright © 2024. All rights reserved.