Package org.dellroad.jct.ssh
Class SshUtil
java.lang.Object
org.dellroad.jct.ssh.SshUtil
Utility methods relating to Apache MINA SSHD.
-
Method Summary
Modifier and TypeMethodDescriptioninferCharacterEncoding
(org.apache.sshd.server.Environment env) Attempt to infer the character encoding associated with an SSH connection.inferLocale
(org.apache.sshd.server.Environment env) Attempt to infer the locale associated with an SSH connection.static Optional<org.jline.terminal.Terminal.Signal>
mapSignalToTerminal
(org.apache.sshd.server.Signal signal) Map SSH channel signal to the correspondingTerminal
signal, if able.static Optional<org.apache.sshd.server.Signal>
mapTerminalToSignal
(org.jline.terminal.Terminal.Signal signal) MapTerminal
signal to the corresponding SSH channel signal.static void
updateAttributesFromEnvironment
(org.jline.terminal.Attributes attr, org.apache.sshd.server.Environment env) UpdateTerminal
attributes based on the given SSH connection.static boolean
updateSize
(org.jline.terminal.Terminal terminal, org.apache.sshd.server.Environment env) UpdateTerminal
window size based on SSH environment variables.
-
Method Details
-
mapSignalToTerminal
public static Optional<org.jline.terminal.Terminal.Signal> mapSignalToTerminal(org.apache.sshd.server.Signal signal) Map SSH channel signal to the correspondingTerminal
signal, if able.- Parameters:
signal
- SSH channel signal- Returns:
- corresponding
Terminal
signal, if known - Throws:
IllegalArgumentException
- ifsignal
is null
-
mapTerminalToSignal
public static Optional<org.apache.sshd.server.Signal> mapTerminalToSignal(org.jline.terminal.Terminal.Signal signal) MapTerminal
signal to the corresponding SSH channel signal.- Parameters:
signal
-Terminal
signal- Returns:
- corresponding SSH channel signal, if known
- Throws:
IllegalArgumentException
- ifsignal
is null
-
inferCharacterEncoding
Attempt to infer the character encoding associated with an SSH connection.- Parameters:
env
- SSH environment- Returns:
- character encoding, if known
- Throws:
IllegalArgumentException
- ifenv
is null
-
inferLocale
Attempt to infer the locale associated with an SSH connection.- Parameters:
env
- SSH environment- Returns:
- local, if known
- Throws:
IllegalArgumentException
- ifenv
is null
-
updateAttributesFromEnvironment
public static void updateAttributesFromEnvironment(org.jline.terminal.Attributes attr, org.apache.sshd.server.Environment env) UpdateTerminal
attributes based on the given SSH connection.- Parameters:
attr
- terminal attributesenv
- SSH connection info- Throws:
IllegalArgumentException
- if either parameter is null
-
updateSize
public static boolean updateSize(org.jline.terminal.Terminal terminal, org.apache.sshd.server.Environment env) UpdateTerminal
window size based on SSH environment variables.- Parameters:
terminal
- the terminal to updateenv
- SSH connection info- Returns:
- true if size was successfully updated
- Throws:
IllegalArgumentException
- if either parameter is null
-