- 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
,java.io.Closeable
,java.lang.AutoCloseable
public class CygwinTerminal extends UnixLikeTTYTerminal
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 Modifier and Type Field Description private static java.lang.String
CYGWIN_HOME_ENV
private static java.lang.String
JAVA_LIBRARY_PATH_PROPERTY
private static java.lang.String
STTY_LOCATION
private static java.util.regex.Pattern
STTY_SIZE_PATTERN
-
Constructor Summary
Constructors Constructor Description CygwinTerminal(java.io.InputStream terminalInput, java.io.OutputStream terminalOutput, java.nio.charset.Charset terminalCharset)
Creates a new CygwinTerminal based off input and output streams and a character set to use
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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 java.lang.String
findProgram(java.lang.String programName)
private java.lang.String
findSTTY()
protected TerminalSize
findTerminalSize()
private java.lang.String
getPseudoTerminalDevice()
protected java.lang.String
runSTTYCommand(java.lang.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 Detail
-
STTY_LOCATION
private static final java.lang.String STTY_LOCATION
-
STTY_SIZE_PATTERN
private static final java.util.regex.Pattern STTY_SIZE_PATTERN
-
JAVA_LIBRARY_PATH_PROPERTY
private static final java.lang.String JAVA_LIBRARY_PATH_PROPERTY
- See Also:
- Constant Field Values
-
CYGWIN_HOME_ENV
private static final java.lang.String CYGWIN_HOME_ENV
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CygwinTerminal
public CygwinTerminal(java.io.InputStream terminalInput, java.io.OutputStream terminalOutput, java.nio.charset.Charset terminalCharset) throws java.io.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:
java.io.IOException
- If there was an I/O error when trying to initialize the class and setup the terminal
-
-
Method Detail
-
findTerminalSize
protected TerminalSize findTerminalSize()
- Overrides:
findTerminalSize
in classANSITerminal
-
runSTTYCommand
protected java.lang.String runSTTYCommand(java.lang.String... parameters) throws java.io.IOException
- Overrides:
runSTTYCommand
in classUnixLikeTTYTerminal
- Throws:
java.io.IOException
-
acquire
protected void acquire() throws java.io.IOException
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:
java.io.IOException
- If there was an I/O error
-
findSTTY
private java.lang.String findSTTY()
-
getPseudoTerminalDevice
private java.lang.String getPseudoTerminalDevice()
-
findProgram
private static java.lang.String findProgram(java.lang.String programName)
-
-