Closeable
, Flushable
, AutoCloseable
, Terminal
JansiWinSysTerminal
, JnaWinSysTerminal
public abstract class AbstractWindowsTerminal extends AbstractTerminal
Terminal.MouseTracking, Terminal.Signal, Terminal.SignalHandler
Modifier and Type | Field | Description |
---|---|---|
protected Attributes |
attributes |
|
protected ShutdownHooks.Task |
closer |
|
protected static int |
ENABLE_ECHO_INPUT |
|
protected static int |
ENABLE_INSERT_MODE |
|
protected static int |
ENABLE_LINE_INPUT |
|
protected static int |
ENABLE_MOUSE_INPUT |
|
protected static int |
ENABLE_PROCESSED_INPUT |
|
protected static int |
ENABLE_QUICK_EDIT_MODE |
|
static int |
ENABLE_VIRTUAL_TERMINAL_PROCESSING |
|
protected static int |
ENABLE_WINDOW_INPUT |
|
protected boolean |
focusTracking |
|
protected NonBlockingInputStream |
input |
|
protected Object |
lock |
|
protected Map<Terminal.Signal,Object> |
nativeHandlers |
|
protected int |
originalConsoleMode |
|
protected OutputStream |
output |
|
protected boolean |
paused |
|
protected Thread |
pump |
|
protected NonBlockingReader |
reader |
|
protected Writer |
slaveInputPipe |
|
protected Terminal.MouseTracking |
tracking |
|
static String |
TYPE_WINDOWS |
|
static String |
TYPE_WINDOWS_256_COLOR |
|
static String |
TYPE_WINDOWS_CONEMU |
|
static String |
TYPE_WINDOWS_VTP |
|
protected PrintWriter |
writer |
bools, encoding, handlers, ints, name, onClose, status, strings, type
TYPE_DUMB, TYPE_DUMB_COLOR
Constructor | Description |
---|---|
AbstractWindowsTerminal(Writer writer,
String name,
String type,
Charset encoding,
int codepage,
boolean nativeSignals,
Terminal.SignalHandler signalHandler) |
Modifier and Type | Method | Description |
---|---|---|
boolean |
canPauseResume() |
Whether this terminal supports
Terminal.pause() and Terminal.resume() calls. |
protected int |
ctrl(char key) |
|
protected void |
doClose() |
|
Attributes |
getAttributes() |
|
protected abstract int |
getConsoleMode() |
|
protected abstract int |
getConsoleOutputCP() |
|
protected String |
getEscapeSequence(short keyCode,
int keyState) |
|
protected String |
getRawSequence(InfoCmp.Capability cap) |
|
Terminal.SignalHandler |
handle(Terminal.Signal signal,
Terminal.SignalHandler handler) |
|
boolean |
hasFocusSupport() |
Returns
true if the terminal has support for focus tracking. |
InputStream |
input() |
Retrieve the input stream for this terminal.
|
OutputStream |
output() |
Retrieve the output stream for this terminal.
|
void |
pause() |
Stop reading the input stream.
|
void |
pause(boolean wait) |
Stop reading the input stream and optionally wait for the underlying threads to finish.
|
boolean |
paused() |
Check whether the terminal is currently reading the input stream or not.
|
protected abstract boolean |
processConsoleInput() |
Read a single input event from the input buffer and process it.
|
void |
processInputChar(char c) |
|
protected void |
processKeyEvent(boolean isKeyDown,
short virtualKeyCode,
char ch,
int controlKeyState) |
|
protected void |
pump() |
|
NonBlockingReader |
reader() |
Retrieve the
Reader for this terminal. |
void |
resume() |
Resume reading the input stream.
|
void |
setAttributes(Attributes attr) |
|
protected abstract void |
setConsoleMode(int mode) |
|
void |
setSize(Size size) |
|
boolean |
trackFocus(boolean tracking) |
Enable or disable focus tracking mode.
|
boolean |
trackMouse(Terminal.MouseTracking tracking) |
Change the mouse tracking mouse.
|
protected void |
updateConsoleMode() |
|
PrintWriter |
writer() |
Retrieve the
Writer for this terminal. |
checkInterrupted, close, echo, echo, echoSignal, encoding, enterRawMode, flush, getBooleanCapability, getCursorPosition, getKind, getName, getNumericCapability, getStatus, getStatus, getStringCapability, getType, hasMouseSupport, parseInfoCmp, puts, raise, readMouseEvent, readMouseEvent, setOnClose
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBufferSize, getHeight, getSize, getWidth
public static final String TYPE_WINDOWS
public static final String TYPE_WINDOWS_256_COLOR
public static final String TYPE_WINDOWS_CONEMU
public static final String TYPE_WINDOWS_VTP
public static final int ENABLE_VIRTUAL_TERMINAL_PROCESSING
protected static final int ENABLE_PROCESSED_INPUT
protected static final int ENABLE_LINE_INPUT
protected static final int ENABLE_ECHO_INPUT
protected static final int ENABLE_WINDOW_INPUT
protected static final int ENABLE_MOUSE_INPUT
protected static final int ENABLE_INSERT_MODE
protected static final int ENABLE_QUICK_EDIT_MODE
protected final Writer slaveInputPipe
protected final NonBlockingInputStream input
protected final OutputStream output
protected final NonBlockingReader reader
protected final PrintWriter writer
protected final Map<Terminal.Signal,Object> nativeHandlers
protected final ShutdownHooks.Task closer
protected final Attributes attributes
protected final int originalConsoleMode
protected final Object lock
protected boolean paused
protected Thread pump
protected Terminal.MouseTracking tracking
protected boolean focusTracking
public AbstractWindowsTerminal(Writer writer, String name, String type, Charset encoding, int codepage, boolean nativeSignals, Terminal.SignalHandler signalHandler) throws IOException
IOException
public Terminal.SignalHandler handle(Terminal.Signal signal, Terminal.SignalHandler handler)
handle
in interface Terminal
handle
in class AbstractTerminal
public NonBlockingReader reader()
Terminal
Reader
for this terminal.
This is the standard way to read input from this terminal.
The reader is non blocking.public PrintWriter writer()
Terminal
Writer
for this terminal.
This is the standard way to write to this terminal.public InputStream input()
Terminal
Terminal.reader()
instead.Terminal.reader()
public OutputStream output()
Terminal
Terminal.writer()
instead.Terminal.writer()
public Attributes getAttributes()
public void setAttributes(Attributes attr)
protected void updateConsoleMode()
protected int ctrl(char key)
public void setSize(Size size)
protected void doClose() throws IOException
doClose
in class AbstractTerminal
IOException
protected void processKeyEvent(boolean isKeyDown, short virtualKeyCode, char ch, int controlKeyState) throws IOException
IOException
protected String getEscapeSequence(short keyCode, int keyState)
protected String getRawSequence(InfoCmp.Capability cap)
public boolean hasFocusSupport()
Terminal
true
if the terminal has support for focus tracking.hasFocusSupport
in interface Terminal
hasFocusSupport
in class AbstractTerminal
Terminal.trackFocus(boolean)
public boolean trackFocus(boolean tracking)
Terminal
trackFocus
in interface Terminal
trackFocus
in class AbstractTerminal
tracking
- whether the focus tracking mode should be enabled or nottrue
if focus tracking is supportedpublic boolean canPauseResume()
Terminal
Terminal.pause()
and Terminal.resume()
calls.canPauseResume
in interface Terminal
canPauseResume
in class AbstractTerminal
Terminal.pause()
and Terminal.resume()
calls.Terminal.paused()
,
Terminal.pause()
,
Terminal.resume()
public void pause()
Terminal
pause
in interface Terminal
pause
in class AbstractTerminal
Terminal.resume()
,
Terminal.paused()
public void pause(boolean wait) throws InterruptedException
Terminal
pause
in interface Terminal
pause
in class AbstractTerminal
wait
- true
to wait until the terminal is actually pausedInterruptedException
- if the call has been interruptedpublic void resume()
Terminal
resume
in interface Terminal
resume
in class AbstractTerminal
Terminal.pause()
,
Terminal.paused()
public boolean paused()
Terminal
paused
in interface Terminal
paused
in class AbstractTerminal
Terminal.pause()
,
Terminal.resume()
protected void pump()
public void processInputChar(char c) throws IOException
IOException
public boolean trackMouse(Terminal.MouseTracking tracking)
Terminal
InfoCmp.Capability.key_mouse
to the input stream.
When this character sequence is detected, the Terminal.readMouseEvent()
method can be
called to actually read the corresponding mouse event.trackMouse
in interface Terminal
trackMouse
in class AbstractTerminal
tracking
- the mouse tracking modetrue
if mouse tracking is supportedprotected abstract int getConsoleOutputCP()
protected abstract int getConsoleMode()
protected abstract void setConsoleMode(int mode)
protected abstract boolean processConsoleInput() throws IOException
IOException
- if anything wrong happensCopyright © 2020. All rights reserved.