public abstract class AbstractWindowsTerminal extends AbstractTerminal
Terminal.MouseTracking, Terminal.Signal, Terminal.SignalHandler| Modifier and Type | Field and 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, status, strings, typeTYPE_DUMB, TYPE_DUMB_COLOR| Constructor and Description |
|---|
AbstractWindowsTerminal(Writer writer,
String name,
String type,
Charset encoding,
int codepage,
boolean nativeSignals,
Terminal.SignalHandler signalHandler) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canPauseResume()
Whether this terminal supports
Terminal.pause() and Terminal.resume() calls. |
void |
close() |
protected int |
ctrl(char key) |
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, echo, echo, echoSignal, encoding, enterRawMode, flush, getBooleanCapability, getCursorPosition, getKind, getName, getNumericCapability, getStatus, getStatus, getStringCapability, getType, hasMouseSupport, parseInfoCmp, puts, raise, readMouseEvent, readMouseEventclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetBufferSize, getHeight, getSize, getWidthpublic 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
IOExceptionpublic Terminal.SignalHandler handle(Terminal.Signal signal, Terminal.SignalHandler handler)
handle in interface Terminalhandle in class AbstractTerminalpublic NonBlockingReader reader()
TerminalReader for this terminal.
This is the standard way to read input from this terminal.
The reader is non blocking.public PrintWriter writer()
TerminalWriter for this terminal.
This is the standard way to write to this terminal.public InputStream input()
TerminalTerminal.reader() instead.Terminal.reader()public OutputStream output()
TerminalTerminal.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)
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class AbstractTerminalIOExceptionprotected void processKeyEvent(boolean isKeyDown,
short virtualKeyCode,
char ch,
int controlKeyState)
throws IOException
IOExceptionprotected String getEscapeSequence(short keyCode, int keyState)
protected String getRawSequence(InfoCmp.Capability cap)
public boolean hasFocusSupport()
Terminaltrue if the terminal has support for focus tracking.hasFocusSupport in interface TerminalhasFocusSupport in class AbstractTerminalTerminal.trackFocus(boolean)public boolean trackFocus(boolean tracking)
TerminaltrackFocus in interface TerminaltrackFocus in class AbstractTerminaltracking - whether the focus tracking mode should be enabled or nottrue if focus tracking is supportedpublic boolean canPauseResume()
TerminalTerminal.pause() and Terminal.resume() calls.canPauseResume in interface TerminalcanPauseResume in class AbstractTerminalTerminal.pause() and Terminal.resume() calls.Terminal.paused(),
Terminal.pause(),
Terminal.resume()public void pause()
Terminalpause in interface Terminalpause in class AbstractTerminalTerminal.resume(),
Terminal.paused()public void pause(boolean wait)
throws InterruptedException
Terminalpause in interface Terminalpause in class AbstractTerminalwait - true to wait until the terminal is actually pausedInterruptedException - if the call has been interruptedpublic void resume()
Terminalresume in interface Terminalresume in class AbstractTerminalTerminal.pause(),
Terminal.paused()public boolean paused()
Terminalpaused in interface Terminalpaused in class AbstractTerminalTerminal.pause(),
Terminal.resume()protected void pump()
public void processInputChar(char c)
throws IOException
IOExceptionpublic boolean trackMouse(Terminal.MouseTracking tracking)
TerminalInfoCmp.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 TerminaltrackMouse in class AbstractTerminaltracking - 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 © 2019. All rights reserved.