Package org.apache.sshd.common.channel
Class SttySupport
java.lang.Object
org.apache.sshd.common.channel.SttySupport
Support for stty command on unix
- Author:
- Apache MINA SSHD Project
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringExecute the specified command and return the output (both stdout and stderr).static Stringstatic intReturns the value of "stty size" height param.static intgetTerminalProperty(String prop) static intReturns the value of "stty size" width param.static StringparsePtyModes(String stty) static voidsetSttyCommand(String cmd) static StringExecute the stty command with the specified arguments against the current active terminal.
-
Field Details
-
DEFAULT_TERMINAL_WIDTH
public static final int DEFAULT_TERMINAL_WIDTH- See Also:
-
DEFAULT_TERMINAL_HEIGHT
public static final int DEFAULT_TERMINAL_HEIGHT- See Also:
-
SSHD_STTY_COMMAND_PROP
- See Also:
-
DEFAULT_SSHD_STTY_COMMAND
- See Also:
-
-
Method Details
-
getUnixPtyModes
- Throws:
IOExceptionInterruptedException
-
parsePtyModes
-
getTerminalWidth
public static int getTerminalWidth()Returns the value of "stty size" width param.
Note: this method caches the value from the first time it is called in order to increase speed, which means that changing to size of the terminal will not be reflected in the console.
- Returns:
- The terminal width
-
getTerminalHeight
public static int getTerminalHeight()Returns the value of "stty size" height param.
Note: this method caches the value from the first time it is called in order to increase speed, which means that changing to size of the terminal will not be reflected in the console.
- Returns:
- The terminal height
-
getTerminalProperty
- Throws:
IOExceptionInterruptedException
-
getTtyProps
- Throws:
IOExceptionInterruptedException
-
stty
Execute the stty command with the specified arguments against the current active terminal.- Parameters:
args- The command arguments- Returns:
- The execution result
- Throws:
IOException- If failed to execute the commandInterruptedException- If interrupted while awaiting command execution- See Also:
-
exec
Execute the specified command and return the output (both stdout and stderr).- Parameters:
cmd- The command to execute- Returns:
- The execution result
- Throws:
IOException- If failed to execute the commandInterruptedException- If interrupted while awaiting command execution- See Also:
-
getSttyCommand
- Returns:
- The command to use to set the terminal options.
- See Also:
-
setSttyCommand
- Parameters:
cmd- The command to use to set the terminal options. Defaults toDEFAULT_SSHD_STTY_COMMAND, or the value of theSSHD_STTY_COMMAND_PROPsystem property if not set via this method
-