Top Description Fields Constructors Methods
org.apache.sshd.common.channel

public final Enum PtyMode

extends Enum<PtyMode>
Class Inheritance
Imports
java.util.Collection, .Collections, .Comparator, .EnumMap, .EnumSet, .Map, .NavigableMap, .Set, java.util.function.Function, .ToIntFunction, org.apache.sshd.common.util.GenericUtils, .MapEntryUtils

A enum describing the tty modes according to RFC 4254 - section 8.
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
public static final Comparator<PtyMode>
BY_OPCODE

A null-safe Comparator of PtyMode values according to their PtyMode#toInt() value

public static final NavigableMap<Integer, PtyMode>
public static final PtyMode
CS7

7 bit mode.

public static final PtyMode
CS8

8 bit mode.

public static final PtyMode
ECHO

Enable echoing.

public static final PtyMode
ECHOCTL

Echo control characters as ^(Char).

public static final PtyMode
ECHOE

Visually erase chars.

public static final PtyMode
ECHOK

Kill character discards current line.

public static final PtyMode
ECHOKE

Visual erase for line kill.

public static final PtyMode
ECHONL

Echo NL even if ECHO is off.

public static final Integer
public static final PtyMode
ICANON

Canonicalize input lines.

public static final PtyMode
ICRNL

Map CR to NL on input.

public static final PtyMode
IEXTEN

Enable extensions.

public static final PtyMode
IGNCR

Ignore CR on input.

public static final PtyMode
IGNPAR

The ignore parity flag.

public static final PtyMode
IMAXBEL

Ring bell on input queue full.

public static final PtyMode
INLCR

Map NL into CR on input.

public static final PtyMode
INPCK

Enable checking of parity errors.

public static final PtyMode
ISIG

Enable signals INTR, QUIT, [D]SUSP.

public static final PtyMode
ISTRIP

Strip 8th bit off characters.

public static final PtyMode
IUCLC

Translate uppercase characters to lowercase.

public static final PtyMode
public static final PtyMode
IXANY

Any char will restart after stop.

public static final PtyMode
IXOFF

Enable input flow control.

public static final PtyMode
IXON

Enable output flow control.

public static final Set<PtyMode>
MODES

An un-modifiable Set of all defined PtyModes

public static final PtyMode
NOFLSH

Don't flush after interrupt.

public static final PtyMode
OCRNL

Translate carriage return to newline (output).

public static final PtyMode
OLCUC

Convert lowercase to uppercase.

public static final PtyMode
ONLCR

Map NL to CR-NL.

public static final PtyMode
ONLRET

Newline performs a carriage return (output).

public static final PtyMode
ONOCR

Translate newline to carriage return-newline (output).

public static final ToIntFunction<PtyMode>
OPCODE_EXTRACTOR

A null-safe ToIntFunction that returns the PtyMode#toInt() value and (-1) for null

public static final PtyMode
OPOST

Enable output processing.

public static final PtyMode
PARENB

Parity enable.

public static final PtyMode
PARMRK

Mark parity and framing errors.

public static final PtyMode
PARODD

Odd parity, else even.

public static final PtyMode
PENDIN

Retype pending input.

public static final PtyMode
TOSTOP

Stop background jobs from output.

public static final Integer
public static final byte
public static final PtyMode
TTY_OP_ISPEED

Specifies the input baud rate in bits per second.

public static final PtyMode
TTY_OP_OSPEED

Specifies the output baud rate in bits per second.

private final int
v

public static final PtyMode
VDISCARD

Toggles the flushing of terminal output.

public static final PtyMode
VDSUSP

Another suspend character.

public static final PtyMode
VEOF

End-of-file character (sends EOF from the terminal).

public static final PtyMode
VEOL

End-of-line character in addition to carriage return and/or line-feed.

public static final PtyMode
VEOL2

Additional end-of-line character.

public static final PtyMode
VERASE

Erase the character to left of the cursor.

public static final PtyMode
VFLUSH

Character to flush output.

public static final PtyMode
VINTR

Interrupt character; 255 if none.

public static final PtyMode
VKILL

Kill the current input line.

public static final PtyMode
VLNEXT

Enter the next character typed literally, even if it is a special character

public static final PtyMode
VQUIT

The quit character (sends SIGQUIT signal on POSIX systems).

public static final PtyMode
VREPRINT

Reprints the current input line.

public static final PtyMode
VSTART

Continues paused output (normally control-Q).

public static final PtyMode
VSTATUS

Prints system status line (load, command, pid, etc).

public static final PtyMode
VSTOP

Pauses output (normally control-S).

public static final PtyMode
VSUSP

Suspends the current program.

public static final PtyMode
VSWTCH

Switch to a different shell layer.

public static final PtyMode
VWERASE

Erases a word left of cursor.

public static final PtyMode
XCASE

Enable input and output of uppercase characters by preceding their lowercase equivalents with "\".

Constructor Summary

AccessConstructor and Description
private
PtyMode(int v)

Method Summary

Modifier and TypeMethod and Description
public static Map<PtyMode, Integer>

Returns:

A Map where all the specified PtyModes have TRUE_SETTING
createEnabledOptions
(PtyMode...
The options to enable - ignored if null/empty
options
)

public static Map<PtyMode, Integer>

Returns:

A Map where all the specified PtyModes have TRUE_SETTING
createEnabledOptions
(Collection<PtyMode>
The options to enable - ignored if null/empty
options
)

public static PtyMode

Returns:

The matching PtyMode or null if no match found
fromInt
(int
The numeric value of the option
b
)

public static PtyMode
public static boolean

Returns:

true if all of these conditions hold:
  • Modes map is not null/empty
  • Required mode setting is not null
  • The setting has a mapped value
  • The mapped value is a Number
  • The Number#intValue() is non-zero
getBooleanSettingValue
(Map<PtyMode, ?>
The current modes Map-ing
modes
,
PtyMode
The required PtyMode
m
)

public static boolean

Returns:

true if the CR mode is enabled:
  • Ifmodes or enablers are null/empty then defaultValue is used
  • If any of the enablers modes are enabled then the CR mode is enabled.
  • If none of the enablers modes were specified then use defaultValue
  • Otherwise (i.e., at least one or more of the enablers modes were specified, but all of them said no) then false.
getBooleanSettingValue
(Map<PtyMode, ?>
The Map of PtyModes resolved by the "pty-req" message.
modes
,
Collection<PtyMode>
A Collection of enabler settings to be consulted
enablers
,
boolean
The default value to be used if no definite setting could be deduced
defaultValue
)

public static boolean

Returns:

true if all of these conditions hold:
getBooleanSettingValue
(Object
The value to be tested
v
)

public static boolean

Returns:

true if value is non-zero
getBooleanSettingValue
(int
The setting value
v
)

public static boolean

Returns:

true if not null and one of the settings that refers to a character value - name usually starts with Vxxx
isCharSetting
(PtyMode m)

public static Set<PtyMode>
resolveEnabledOptions(Map<PtyMode, ?> modes, PtyMode... options)

public static Set<PtyMode>

Returns:

A Set of all the PtyModes that appeared in the settings and were enabled
resolveEnabledOptions
(Map<PtyMode, ?>
The PTY settings - ignored if null/empty
modes
,
Collection<PtyMode>
The options that should be enabled
options
)

public int
public static PtyMode
public static PtyMode[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

BY_OPCODEback to summary
public static final Comparator<PtyMode> BY_OPCODE

A null-safe Comparator of PtyMode values according to their PtyMode#toInt() value

See Also
OPCODE_EXTRACTOR
COMMANDSback to summary
public static final NavigableMap<Integer, PtyMode> COMMANDS
CS7back to summary
public static final PtyMode CS7

7 bit mode.

CS8back to summary
public static final PtyMode CS8

8 bit mode.

ECHOback to summary
public static final PtyMode ECHO

Enable echoing.

ECHOCTLback to summary
public static final PtyMode ECHOCTL

Echo control characters as ^(Char).

ECHOEback to summary
public static final PtyMode ECHOE

Visually erase chars.

ECHOKback to summary
public static final PtyMode ECHOK

Kill character discards current line.

ECHOKEback to summary
public static final PtyMode ECHOKE

Visual erase for line kill.

ECHONLback to summary
public static final PtyMode ECHONL

Echo NL even if ECHO is off.

FALSE_SETTINGback to summary
public static final Integer FALSE_SETTING
ICANONback to summary
public static final PtyMode ICANON

Canonicalize input lines.

ICRNLback to summary
public static final PtyMode ICRNL

Map CR to NL on input.

IEXTENback to summary
public static final PtyMode IEXTEN

Enable extensions.

IGNCRback to summary
public static final PtyMode IGNCR

Ignore CR on input.

IGNPARback to summary
public static final PtyMode IGNPAR

The ignore parity flag. The parameter SHOULD be 0 if this flag is FALSE, and 1 if it is TRUE.

IMAXBELback to summary
public static final PtyMode IMAXBEL

Ring bell on input queue full.

INLCRback to summary
public static final PtyMode INLCR

Map NL into CR on input.

INPCKback to summary
public static final PtyMode INPCK

Enable checking of parity errors.

ISIGback to summary
public static final PtyMode ISIG

Enable signals INTR, QUIT, [D]SUSP.

ISTRIPback to summary
public static final PtyMode ISTRIP

Strip 8th bit off characters.

IUCLCback to summary
public static final PtyMode IUCLC

Translate uppercase characters to lowercase.

IUTF8back to summary
public static final PtyMode IUTF8
See Also
IUTF8 Terminal Mode in Secure Shell
IXANYback to summary
public static final PtyMode IXANY

Any char will restart after stop.

IXOFFback to summary
public static final PtyMode IXOFF

Enable input flow control.

IXONback to summary
public static final PtyMode IXON

Enable output flow control.

MODESback to summary
public static final Set<PtyMode> MODES

An un-modifiable Set of all defined PtyModes

NOFLSHback to summary
public static final PtyMode NOFLSH

Don't flush after interrupt.

OCRNLback to summary
public static final PtyMode OCRNL

Translate carriage return to newline (output).

OLCUCback to summary
public static final PtyMode OLCUC

Convert lowercase to uppercase.

ONLCRback to summary
public static final PtyMode ONLCR

Map NL to CR-NL.

ONLRETback to summary
public static final PtyMode ONLRET

Newline performs a carriage return (output).

ONOCRback to summary
public static final PtyMode ONOCR

Translate newline to carriage return-newline (output).

OPCODE_EXTRACTORback to summary
public static final ToIntFunction<PtyMode> OPCODE_EXTRACTOR

A null-safe ToIntFunction that returns the PtyMode#toInt() value and (-1) for null

OPOSTback to summary
public static final PtyMode OPOST

Enable output processing.

PARENBback to summary
public static final PtyMode PARENB

Parity enable.

PARMRKback to summary
public static final PtyMode PARMRK

Mark parity and framing errors.

PARODDback to summary
public static final PtyMode PARODD

Odd parity, else even.

PENDINback to summary
public static final PtyMode PENDIN

Retype pending input.

TOSTOPback to summary
public static final PtyMode TOSTOP

Stop background jobs from output.

TRUE_SETTINGback to summary
public static final Integer TRUE_SETTING
TTY_OP_ENDback to summary
public static final byte TTY_OP_END
TTY_OP_ISPEEDback to summary
public static final PtyMode TTY_OP_ISPEED

Specifies the input baud rate in bits per second.

TTY_OP_OSPEEDback to summary
public static final PtyMode TTY_OP_OSPEED

Specifies the output baud rate in bits per second.

vback to summary
private final int v
VDISCARDback to summary
public static final PtyMode VDISCARD

Toggles the flushing of terminal output.

VDSUSPback to summary
public static final PtyMode VDSUSP

Another suspend character.

VEOFback to summary
public static final PtyMode VEOF

End-of-file character (sends EOF from the terminal).

VEOLback to summary
public static final PtyMode VEOL

End-of-line character in addition to carriage return and/or line-feed.

VEOL2back to summary
public static final PtyMode VEOL2

Additional end-of-line character.

VERASEback to summary
public static final PtyMode VERASE

Erase the character to left of the cursor.

VFLUSHback to summary
public static final PtyMode VFLUSH

Character to flush output.

VINTRback to summary
public static final PtyMode VINTR

Interrupt character; 255 if none. Similarly for the other characters. Not all of these characters are supported on all systems.

VKILLback to summary
public static final PtyMode VKILL

Kill the current input line.

VLNEXTback to summary
public static final PtyMode VLNEXT

Enter the next character typed literally, even if it is a special character

VQUITback to summary
public static final PtyMode VQUIT

The quit character (sends SIGQUIT signal on POSIX systems).

VREPRINTback to summary
public static final PtyMode VREPRINT

Reprints the current input line.

VSTARTback to summary
public static final PtyMode VSTART

Continues paused output (normally control-Q).

VSTATUSback to summary
public static final PtyMode VSTATUS

Prints system status line (load, command, pid, etc).

VSTOPback to summary
public static final PtyMode VSTOP

Pauses output (normally control-S).

VSUSPback to summary
public static final PtyMode VSUSP

Suspends the current program.

VSWTCHback to summary
public static final PtyMode VSWTCH

Switch to a different shell layer.

VWERASEback to summary
public static final PtyMode VWERASE

Erases a word left of cursor.

XCASEback to summary
public static final PtyMode XCASE

Enable input and output of uppercase characters by preceding their lowercase equivalents with "\".

Constructor Detail

PtyModeback to summary
private PtyMode(int v)

Method Detail

createEnabledOptionsback to summary
public static Map<PtyMode, Integer> createEnabledOptions(PtyMode... options)
Parameters
options:PtyMode[]

The options to enable - ignored if null/empty

Returns:Map<PtyMode, Integer>

A Map where all the specified PtyModes have TRUE_SETTING

createEnabledOptionsback to summary
public static Map<PtyMode, Integer> createEnabledOptions(Collection<PtyMode> options)
Parameters
options:Collection<PtyMode>

The options to enable - ignored if null/empty

Returns:Map<PtyMode, Integer>

A Map where all the specified PtyModes have TRUE_SETTING

fromIntback to summary
public static PtyMode fromInt(int b)
Parameters
b:int

The numeric value of the option

Returns:PtyMode

The matching PtyMode or null if no match found

See Also
toInt()
fromNameback to summary
public static PtyMode fromName(String name)
getBooleanSettingValueback to summary
public static boolean getBooleanSettingValue(Map<PtyMode, ?> modes, PtyMode m)
Parameters
modes:Map<PtyMode, ?>

The current modes Map-ing

m:PtyMode

The required PtyMode

Returns:boolean

true if all of these conditions hold:

  • Modes map is not null/empty
  • Required mode setting is not null
  • The setting has a mapped value
  • The mapped value is a Number
  • The Number#intValue() is non-zero
See Also
getBooleanSettingValue(Object)
getBooleanSettingValueback to summary
public static boolean getBooleanSettingValue(Map<PtyMode, ?> modes, Collection<PtyMode> enablers, boolean defaultValue)
Parameters
modes:Map<PtyMode, ?>

The Map of PtyModes resolved by the "pty-req" message.

enablers:Collection<PtyMode>

A Collection of enabler settings to be consulted

defaultValue:boolean

The default value to be used if no definite setting could be deduced

Returns:boolean

true if the CR mode is enabled:

  • Ifmodes or enablers are null/empty then defaultValue is used
  • If any of the enablers modes are enabled then the CR mode is enabled.
  • If none of the enablers modes were specified then use defaultValue
  • Otherwise (i.e., at least one or more of the enablers modes were specified, but all of them said no) then false.
getBooleanSettingValueback to summary
public static boolean getBooleanSettingValue(Object v)
Parameters
v:Object

The value to be tested

Returns:boolean

true if all of these conditions hold:

See Also
getBooleanSettingValue(int)
getBooleanSettingValueback to summary
public static boolean getBooleanSettingValue(int v)
Parameters
v:int

The setting value

Returns:boolean

true if value is non-zero

isCharSettingback to summary
public static boolean isCharSetting(PtyMode m)
Parameters
m:PtyMode

The PtyMode

Returns:boolean

true if not null and one of the settings that refers to a character value - name usually starts with Vxxx

resolveEnabledOptionsback to summary
public static Set<PtyMode> resolveEnabledOptions(Map<PtyMode, ?> modes, PtyMode... options)
resolveEnabledOptionsback to summary
public static Set<PtyMode> resolveEnabledOptions(Map<PtyMode, ?> modes, Collection<PtyMode> options)
Parameters
modes:Map<PtyMode, ?>

The PTY settings - ignored if null/empty

options:Collection<PtyMode>

The options that should be enabled

Returns:Set<PtyMode>

A Set of all the PtyModes that appeared in the settings and were enabled

See Also
getBooleanSettingValue(Map, PtyMode)
toIntback to summary
public int toInt()
valueOfback to summary
public static PtyMode valueOf(String name)
valuesback to summary
public static PtyMode[] values()