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 com.googlecode.lanterna.terminal.ansi.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 void
acquire()
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 String
findProgram
(String programName) private String
findSTTY()
protected TerminalSize
private String
protected String
runSTTYCommand
(String... parameters) Methods inherited from class com.googlecode.lanterna.terminal.ansi.UnixLikeTTYTerminal
canonicalMode, exec, keyEchoEnabled, keyStrokeSignalsEnabled, registerTerminalResizeListener, restoreTerminalSettings, saveTerminalSettings
Methods inherited from class com.googlecode.lanterna.terminal.ansi.UnixLikeTerminal
close, getTerminalCtrlCBehaviour, pollInput, readInput
Methods inherited from class com.googlecode.lanterna.terminal.ansi.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, unmaximize
Methods inherited from class com.googlecode.lanterna.terminal.ansi.StreamBasedTerminal
bell, enquireTerminal, flush, getCharset, getInputDecoder, putCharacter, putString, resetMemorizedCursorPosition, translateCharacter, waitForCursorPositionReport, writeToTerminal
Methods inherited from class com.googlecode.lanterna.terminal.AbstractTerminal
addResizeListener, newTextGraphics, onResized, onResized, removeResizeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.googlecode.lanterna.terminal.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:
findTerminalSize
in classANSITerminal
-
runSTTYCommand
- Overrides:
runSTTYCommand
in classUnixLikeTTYTerminal
- Throws:
IOException
-
acquire
Description copied from class:UnixLikeTerminal
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. This should be called automatically by the constructor of any end-user class extending fromUnixLikeTerminal
- Overrides:
acquire
in classUnixLikeTTYTerminal
- Throws:
IOException
- If there was an I/O error
-
findSTTY
-
getPseudoTerminalDevice
-
findProgram
-