Class TerminalModes

java.lang.Object
com.sshtools.synergy.ssh.TerminalModes

public final class TerminalModes extends Object

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
  • Method Details

    • modes

      public Map<TerminalModes.Mode,Integer> 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 the SshSession.
      Returns:
      byte[]
    • get

      public int get(TerminalModes.Mode mode)
      Get the value of a numeric node, or zero if it does not exist
      Parameters:
      mode -
      default -
      Returns:
      value
    • get

      public int get(TerminalModes.Mode mode, int defaultValue)
      Get the value of a number node, or a default if it does not exist.
      Parameters:
      mode -
      default -
      Returns:
      value
    • is

      public boolean is(TerminalModes.Mode mode)
      Get if a mode is set (i.e. is non-zero). If the mode is not in the set, false will be returned.
      Parameters:
      mode - mode
      Returns:
      mode is preent and non-zero
    • is

      public boolean is(TerminalModes.Mode mode, boolean defaultValue)
      Get if a mode is set (i.e. is non-zero) or a default if it does not exist.
      Parameters:
      mode - mode
      defaultValue - default value
      Returns:
      mode is non-zero
    • present

      public boolean present(TerminalModes.Mode mode)
      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 -