Class TtyCommand
java.lang.Object
org.aesh.terminal.ssh.TtyCommand
- All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.sshd.server.channel.ChannelDataReceiver, org.apache.sshd.server.channel.ChannelSessionAware, org.apache.sshd.server.command.AsyncCommand, org.apache.sshd.server.command.AsyncCommandErrorStreamAware, org.apache.sshd.server.command.AsyncCommandInputStreamAware, org.apache.sshd.server.command.AsyncCommandOutputStreamAware, org.apache.sshd.server.command.AsyncCommandStreamsAware, org.apache.sshd.server.command.Command, org.apache.sshd.server.command.CommandDirectErrorStreamAware, org.apache.sshd.server.command.CommandDirectInputStreamAware, org.apache.sshd.server.command.CommandDirectOutputStreamAware, org.apache.sshd.server.command.CommandDirectStreamsAware, org.apache.sshd.server.command.CommandLifecycle
public class TtyCommand
extends Object
implements org.apache.sshd.server.command.AsyncCommand, org.apache.sshd.server.channel.ChannelDataReceiver, org.apache.sshd.server.channel.ChannelSessionAware
SSH command implementation that handles TTY connections and data transfer.
- Author:
- Julien Viet
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.sshd.server.channel.ChannelSessionThe SSH channel session associated with this command. -
Constructor Summary
ConstructorsConstructorDescriptionTtyCommand(Charset defaultCharset, Consumer<Connection> handler) Creates a new TtyCommand with the specified charset and connection handler. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intdata(org.apache.sshd.server.channel.ChannelSession channel, byte[] buf, int start, int len) voiddestroy(org.apache.sshd.server.channel.ChannelSession channelSession) protected voidExecutes a task asynchronously using the SSH session's executor service.protected voidSchedules a task for delayed execution using the SSH session's executor service.voidsetChannelSession(org.apache.sshd.server.channel.ChannelSession session) voidvoidsetExitCallback(org.apache.sshd.server.ExitCallback callback) voidvoidsetIoErrorStream(org.apache.sshd.common.io.IoOutputStream err) voidsetIoInputStream(org.apache.sshd.common.io.IoInputStream in) voidsetIoOutputStream(org.apache.sshd.common.io.IoOutputStream out) voidvoidstart(org.apache.sshd.server.channel.ChannelSession channelSession, org.apache.sshd.server.Environment env) voidupdateSize(org.apache.sshd.server.Environment env) Updates the terminal size from the SSH environment variables.
-
Field Details
-
session
protected org.apache.sshd.server.channel.ChannelSession sessionThe SSH channel session associated with this command.
-
-
Constructor Details
-
TtyCommand
Creates a new TtyCommand with the specified charset and connection handler.- Parameters:
defaultCharset- the default character set for encoding/decodinghandler- the consumer that handles new connections
-
-
Method Details
-
data
public int data(org.apache.sshd.server.channel.ChannelSession channel, byte[] buf, int start, int len) throws IOException - Specified by:
datain interfaceorg.apache.sshd.server.channel.ChannelDataReceiver- Throws:
IOException
-
setChannelSession
public void setChannelSession(org.apache.sshd.server.channel.ChannelSession session) - Specified by:
setChannelSessionin interfaceorg.apache.sshd.server.channel.ChannelSessionAware
-
setInputStream
- Specified by:
setInputStreamin interfaceorg.apache.sshd.server.command.CommandDirectInputStreamAware
-
setOutputStream
- Specified by:
setOutputStreamin interfaceorg.apache.sshd.server.command.CommandDirectOutputStreamAware
-
setErrorStream
- Specified by:
setErrorStreamin interfaceorg.apache.sshd.server.command.CommandDirectErrorStreamAware
-
setIoInputStream
public void setIoInputStream(org.apache.sshd.common.io.IoInputStream in) - Specified by:
setIoInputStreamin interfaceorg.apache.sshd.server.command.AsyncCommandInputStreamAware
-
setIoOutputStream
public void setIoOutputStream(org.apache.sshd.common.io.IoOutputStream out) - Specified by:
setIoOutputStreamin interfaceorg.apache.sshd.server.command.AsyncCommandOutputStreamAware
-
setIoErrorStream
public void setIoErrorStream(org.apache.sshd.common.io.IoOutputStream err) - Specified by:
setIoErrorStreamin interfaceorg.apache.sshd.server.command.AsyncCommandErrorStreamAware
-
setExitCallback
public void setExitCallback(org.apache.sshd.server.ExitCallback callback) - Specified by:
setExitCallbackin interfaceorg.apache.sshd.server.command.Command
-
start
public void start(org.apache.sshd.server.channel.ChannelSession channelSession, org.apache.sshd.server.Environment env) throws IOException - Specified by:
startin interfaceorg.apache.sshd.server.command.CommandLifecycle- Throws:
IOException
-
updateSize
public void updateSize(org.apache.sshd.server.Environment env) Updates the terminal size from the SSH environment variables.- Parameters:
env- the SSH environment containing size information
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
destroy
-
execute
Executes a task asynchronously using the SSH session's executor service.- Parameters:
task- the task to execute
-
schedule
-