public class CygwinTerminal extends UnixLikeTerminal
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.
UnixLikeTerminal.CtrlCBehaviour
terminalCtrlCBehaviour, ttyDev
Constructor and Description |
---|
CygwinTerminal(InputStream terminalInput,
OutputStream terminalOutput,
Charset terminalCharset)
Creates a new CygwinTerminal based off input and output streams and a character set to use
|
Modifier and Type | Method and Description |
---|---|
protected String |
findSTTY() |
TerminalSize |
getTerminalSize()
Returns the size of the terminal, expressed as a
TerminalSize object. |
protected void |
sttyICanon(boolean enable) |
protected void |
sttyKeyEcho(boolean enable) |
protected void |
sttyMinimum1CharacterForRead() |
protected void |
sttyRestore(String tok) |
protected String |
sttySave() |
exec, pollInput, readInput, restoreSTTY, saveSTTY, setCBreak, setEcho, setupShutdownHook, setupWinResizeHandler
clearScreen, deiconify, disableSGR, enableSGR, enterPrivateMode, exitPrivateMode, getDefaultKeyDecodingProfile, iconify, maximize, popTitle, pushTitle, resetColorAndSGR, scrollLines, setBackgroundColor, setCursorPosition, setCursorVisible, setForegroundColor, setMouseCaptureMode, setTerminalSize, setTitle, unmaximize
addKeyDecodingProfile, enquireTerminal, flush, getCharset, getInputDecoder, putCharacter, translateCharacter, writeToTerminal
addResizeListener, newTextGraphics, onResized, removeResizeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addResizeListener, enquireTerminal, flush, newTextGraphics, putCharacter, removeResizeListener
public CygwinTerminal(InputStream terminalInput, OutputStream terminalOutput, Charset terminalCharset) throws IOException
terminalInput
- Input stream to read input fromterminalOutput
- Output stream to write output toterminalCharset
- Character set to use when writing to the output streamIOException
- If there was an I/O error when trying to initialize the class and setup the terminalpublic TerminalSize getTerminalSize()
Terminal
TerminalSize
object. Please bear in mind that depending
on the Terminal
implementation, this may or may not be accurate. See the implementing classes for more
information. Most commonly, calling getTerminalSize() will involve some kind of hack to retrieve the size of the
terminal, like moving the cursor to position 5000x5000 and then read back the location, unless the terminal
implementation has a more smooth way of getting this data. Keep this in mind and see if you can avoid calling
this method too often. There is a helper class, SimpleTerminalResizeListener, that you can use to cache the size
and update it only when resize events are received (which depends on if a resize is detectable, which they are not
on all platforms).getTerminalSize
in interface Terminal
getTerminalSize
in class ANSITerminal
protected void sttyKeyEcho(boolean enable) throws IOException
sttyKeyEcho
in class UnixLikeTerminal
IOException
protected void sttyMinimum1CharacterForRead() throws IOException
sttyMinimum1CharacterForRead
in class UnixLikeTerminal
IOException
protected void sttyICanon(boolean enable) throws IOException
sttyICanon
in class UnixLikeTerminal
IOException
protected String sttySave() throws IOException
sttySave
in class UnixLikeTerminal
IOException
protected void sttyRestore(String tok) throws IOException
sttyRestore
in class UnixLikeTerminal
IOException
protected String findSTTY()
Copyright © 2016. All rights reserved.