Package org.aesh.terminal.tty.impl
Class ExecPty
java.lang.Object
org.aesh.terminal.tty.impl.ExecPty
- All Implemented Interfaces:
Closeable,AutoCloseable,Pty
PTY implementation that uses external commands (stty, tty) to interact with the terminal.
This is the default PTY implementation for POSIX systems.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static Ptycurrent()Returns the PTY for the current terminal.protected StringRetrieves the terminal configuration using the stty command.getAttr()Returns the current terminal attributes.Returns the master side input stream.Returns the master side output stream.getName()Returns the name of the TTY device.getSize()Returns the current terminal size.Returns the slave side input stream.Returns the slave side output stream.voidsetAttr(Attributes attr) Sets the terminal attributes.
-
Constructor Details
-
ExecPty
Constructs an ExecPty with the specified TTY name.- Parameters:
name- the name of the TTY device
-
-
Method Details
-
current
Returns the PTY for the current terminal.- Returns:
- the current PTY
- Throws:
IOException- if not running in a TTY or an I/O error occurs
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getName
Returns the name of the TTY device.- Returns:
- the TTY device name
-
getMasterInput
Description copied from interface:PtyReturns the master side input stream.- Specified by:
getMasterInputin interfacePty- Returns:
- the master input stream
-
getMasterOutput
Description copied from interface:PtyReturns the master side output stream.- Specified by:
getMasterOutputin interfacePty- Returns:
- the master output stream
-
getSlaveInput
Description copied from interface:PtyReturns the slave side input stream.- Specified by:
getSlaveInputin interfacePty- Returns:
- the slave input stream
- Throws:
IOException- if an I/O error occurs
-
getSlaveOutput
Description copied from interface:PtyReturns the slave side output stream.- Specified by:
getSlaveOutputin interfacePty- Returns:
- the slave output stream
- Throws:
IOException- if an I/O error occurs
-
getAttr
Description copied from interface:PtyReturns the current terminal attributes.- Specified by:
getAttrin interfacePty- Returns:
- the terminal attributes
- Throws:
IOException- if an I/O error occurs
-
setAttr
Description copied from interface:PtySets the terminal attributes.- Specified by:
setAttrin interfacePty- Parameters:
attr- the attributes to set- Throws:
IOException- if an I/O error occurs
-
getSize
Description copied from interface:PtyReturns the current terminal size.- Specified by:
getSizein interfacePty- Returns:
- the terminal size
- Throws:
IOException- if an I/O error occurs
-
doGetConfig
Retrieves the terminal configuration using the stty command.- Returns:
- the terminal configuration string
- Throws:
IOException- if an I/O error occurs
-