Class CygwinTerminal
java.lang.Object
com.googlecode.lanterna.terminal.AbstractTerminal
com.googlecode.lanterna.terminal.ansi.StreamBasedTerminal
com.googlecode.lanterna.terminal.ansi.ANSITerminal
com.googlecode.lanterna.terminal.ansi.UnixLikeTerminal
com.googlecode.lanterna.terminal.ansi.UnixLikeTTYTerminal
com.googlecode.lanterna.terminal.ansi.CygwinTerminal
- All Implemented Interfaces:
Scrollable, InputProvider, ExtendedTerminal, Terminal, Closeable, AutoCloseable
This class extends UnixLikeTerminal and implements the Cygwin-specific implementations. This means, running a Java
application using Lanterna inside the Cygwin Terminal application. The standard Windows command prompt (cmd.exe) is
not supported by this class.
NOTE: This class is experimental and does not fully work! Some of the operations, like disabling echo and changing cbreak seems to be impossible to do without resorting to native code. Running "stty raw" before starting the JVM will improve compatibility.
NOTE: This class will try to find Cygwin by scanning the directories on java.library.path, but you can also tell it where Cygwin is installed by setting the CYGWIN_HOME environment variable.
-
Nested Class Summary
Nested classes/interfaces inherited from class UnixLikeTerminal
UnixLikeTerminal.CtrlCBehaviour -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCygwinTerminal(InputStream terminalInput, OutputStream terminalOutput, Charset terminalCharset) Creates a new CygwinTerminal based off input and output streams and a character set to use -
Method Summary
Modifier and TypeMethodDescriptionprotected voidacquire()Effectively taking over the terminal and enabling it for Lanterna to use, by turning off echo and canonical mode, adding resize listeners and optionally trap unix signals.private static StringfindProgram(String programName) private StringfindSTTY()protected TerminalSizeprivate Stringprotected StringrunSTTYCommand(String... parameters) Methods inherited from class UnixLikeTTYTerminal
canonicalMode, exec, keyEchoEnabled, keyStrokeSignalsEnabled, registerTerminalResizeListener, restoreTerminalSettings, saveTerminalSettingsMethods inherited from class UnixLikeTerminal
close, getTerminalCtrlCBehaviour, pollInput, readInputMethods inherited from class ANSITerminal
clearScreen, deiconify, disableSGR, enableSGR, enterPrivateMode, exitPrivateMode, getCursorPosition, getDefaultKeyDecodingProfile, getTerminalSize, iconify, isInPrivateMode, maximize, popTitle, pushTitle, reportPosition, resetColorAndSGR, restoreCursorPosition, saveCursorPosition, scrollLines, setBackgroundColor, setCursorPosition, setCursorPosition, setCursorVisible, setForegroundColor, setMouseCaptureMode, setTerminalSize, setTitle, unmaximizeMethods inherited from class StreamBasedTerminal
bell, enquireTerminal, flush, getCharset, getInputDecoder, putCharacter, putString, resetMemorizedCursorPosition, translateCharacter, waitForCursorPositionReport, writeToTerminalMethods inherited from class AbstractTerminal
addResizeListener, newTextGraphics, onResized, onResized, removeResizeListenerMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Terminal
addResizeListener, bell, enquireTerminal, flush, newTextGraphics, putCharacter, putString, removeResizeListener
-
Field Details
-
STTY_LOCATION
-
STTY_SIZE_PATTERN
-
JAVA_LIBRARY_PATH_PROPERTY
- See Also:
-
CYGWIN_HOME_ENV
- See Also:
-
-
Constructor Details
-
CygwinTerminal
public CygwinTerminal(InputStream terminalInput, OutputStream terminalOutput, Charset terminalCharset) throws IOException Creates a new CygwinTerminal based off input and output streams and a character set to use- Parameters:
terminalInput- Input stream to read input fromterminalOutput- Output stream to write output toterminalCharset- Character set to use when writing to the output stream- Throws:
IOException- If there was an I/O error when trying to initialize the class and setup the terminal
-
-
Method Details
-
findTerminalSize
- Overrides:
findTerminalSizein classANSITerminal
-
runSTTYCommand
- Overrides:
runSTTYCommandin classUnixLikeTTYTerminal- Throws:
IOException
-
acquire
Description copied from class:UnixLikeTerminalEffectively taking over the terminal and enabling it for Lanterna to use, by turning off echo and canonical mode, adding resize listeners and optionally trap unix signals. This should be called automatically by the constructor of any end-user class extending fromUnixLikeTerminal- Overrides:
acquirein classUnixLikeTTYTerminal- Throws:
IOException- If there was an I/O error
-
findSTTY
-
getPseudoTerminalDevice
-
findProgram
-