public final class SttySupport extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_SSHD_STTY_COMMAND |
static int |
DEFAULT_TERMINAL_HEIGHT |
static int |
DEFAULT_TERMINAL_WIDTH |
static String |
SSHD_STTY_COMMAND_PROP |
Modifier and Type | Method and Description |
---|---|
static String |
exec(String cmd)
Execute the specified command and return the output
(both stdout and stderr).
|
static String |
getSttyCommand() |
static int |
getTerminalHeight()
Returns the value of "stty size" height param.
|
static int |
getTerminalWidth()
Returns the value of "stty size" width param.
|
static String |
getTtyProps() |
static Map<PtyMode,Integer> |
getUnixPtyModes() |
static Map<PtyMode,Integer> |
parsePtyModes(String stty) |
static void |
setSttyCommand(String cmd) |
static String |
stty(String args)
Execute the stty command with the specified arguments
against the current active terminal.
|
public static final int DEFAULT_TERMINAL_WIDTH
public static final int DEFAULT_TERMINAL_HEIGHT
public static final String SSHD_STTY_COMMAND_PROP
public static final String DEFAULT_SSHD_STTY_COMMAND
public static Map<PtyMode,Integer> getUnixPtyModes() throws IOException, InterruptedException
IOException
InterruptedException
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.
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.
public static String getTtyProps() throws IOException, InterruptedException
IOException
InterruptedException
public static String stty(String args) throws IOException, InterruptedException
args
- The command argumentsIOException
- If failed to execute the commandInterruptedException
- If interrupted while awaiting command executionexec(String)
public static String exec(String cmd) throws IOException, InterruptedException
cmd
- The command to executeIOException
- If failed to execute the commandInterruptedException
- If interrupted while awaiting command executionexec(String[])
public static String getSttyCommand()
setSttyCommand(String)
public static void setSttyCommand(String cmd)
cmd
- The command to use to set the terminal options. Defaults
to DEFAULT_SSHD_STTY_COMMAND
, or the value of the
SSHD_STTY_COMMAND_PROP
system property if not set via this methodCopyright © 2008–2016 The Apache Software Foundation. All rights reserved.