Package com.sshtools.synergy.ssh
Class TerminalModes
java.lang.Object
com.sshtools.synergy.ssh.TerminalModes
When a client requests a pseudo terminal it informs the server of any terminal modes that it knows of. This is typically used in situations where advance terminal configuration is required but it can also be used to perform simple configuration such as turning off character echo.
NOTE: the server may ignore some of the modes set if it does not support them.
var session = ssh.openSessionChannel();
session.requestPseudoTerminal("vt100", 80, 24, 0, 0, TerminalModesBuilder.create().
// Turning off echo
withMode(TerminalModes.Mode.ECHO, false).
// Setting the Input/Output baud rate
withMode(TerminalModes.Mode.TTY_OP_ISPEED, 38400).
withMode(TerminalModes.Mode.TTY_OP_OSPEED, 38400).
build());
- Author:
- Brett Smith, Lee David Painter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration of supported modes.static final classBuildsTerminalModes. -
Method Summary
Modifier and TypeMethodDescriptionintget(TerminalModes.Mode mode) Get the value of a numeric node, or zero if it does not existintget(TerminalModes.Mode mode, int defaultValue) Get the value of a number node, or a default if it does not exist.booleanis(TerminalModes.Mode mode) Get if a mode is set (i.e.booleanis(TerminalModes.Mode mode, boolean defaultValue) Get if a mode is set (i.e.modes()Get all of the modes and their values as a map.booleanpresent(TerminalModes.Mode mode) Get if a mode is present in the set.byte[]Returns the encoded modes for use by theSshSession.voidwrite(com.sshtools.common.util.ByteArrayWriter writer) Write the modes to the writer.
-
Method Details
-
modes
Get all of the modes and their values as a map.- Returns:
- modes
-
toByteArray
public byte[] toByteArray()Returns the encoded modes for use by theSshSession.- Returns:
- byte[]
-
get
Get the value of a numeric node, or zero if it does not exist- Parameters:
mode-default-- Returns:
- value
-
get
Get the value of a number node, or a default if it does not exist.- Parameters:
mode-default-- Returns:
- value
-
is
Get if a mode is set (i.e. is non-zero). If the mode is not in the set,falsewill be returned.- Parameters:
mode- mode- Returns:
- mode is preent and non-zero
-
is
Get if a mode is set (i.e. is non-zero) or a default if it does not exist.- Parameters:
mode- modedefaultValue- default value- Returns:
- mode is non-zero
-
present
Get if a mode is present in the set.- Parameters:
mode- mode- Returns:
- mode is present and non-zero
-
write
public void write(com.sshtools.common.util.ByteArrayWriter writer) Write the modes to the writer.- Parameters:
writer-
-