AutoCloseable
, Closeable
, Flushable
AbstractPosixTerminal
, AbstractTerminal
, AbstractWindowsTerminal
, DumbTerminal
, ExternalTerminal
, LineDisciplineTerminal
, PosixPtyTerminal
, PosixSysTerminal
public interface Terminal extends Closeable, Flushable
Closeable.close()
method
in order to restore their original state.Modifier and Type | Interface | Description |
---|---|---|
static class |
Terminal.MouseTracking |
|
static class |
Terminal.Signal |
|
static interface |
Terminal.SignalHandler |
Modifier and Type | Field | Description |
---|---|---|
static String |
TYPE_DUMB |
Type used for dumb terminals.
|
static String |
TYPE_DUMB_COLOR |
Modifier and Type | Method | Description |
---|---|---|
boolean |
canPauseResume() |
|
boolean |
echo() |
|
boolean |
echo(boolean echo) |
|
Charset |
encoding() |
|
Attributes |
enterRawMode() |
|
void |
flush() |
|
Attributes |
getAttributes() |
|
boolean |
getBooleanCapability(InfoCmp.Capability capability) |
|
default Size |
getBufferSize() |
Retrieve the size of the window buffer.
|
Cursor |
getCursorPosition(IntConsumer discarded) |
Query the terminal to report the cursor position.
|
default int |
getHeight() |
|
String |
getName() |
|
Integer |
getNumericCapability(InfoCmp.Capability capability) |
|
Size |
getSize() |
Retrieve the size of the visible window
|
String |
getStringCapability(InfoCmp.Capability capability) |
|
String |
getType() |
|
default int |
getWidth() |
|
Terminal.SignalHandler |
handle(Terminal.Signal signal,
Terminal.SignalHandler handler) |
|
boolean |
hasFocusSupport() |
Returns
true if the terminal has support for focus tracking. |
boolean |
hasMouseSupport() |
Returns
true if the terminal has support for mouse. |
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.
|
boolean |
puts(InfoCmp.Capability capability,
Object... params) |
|
void |
raise(Terminal.Signal signal) |
|
NonBlockingReader |
reader() |
Retrieve the
Reader for this terminal. |
MouseEvent |
readMouseEvent() |
Read a MouseEvent from the terminal input stream.
|
MouseEvent |
readMouseEvent(IntSupplier reader) |
Read a MouseEvent from the given input stream.
|
void |
resume() |
Resume reading the input stream.
|
void |
setAttributes(Attributes attr) |
|
void |
setSize(Size size) |
|
boolean |
trackFocus(boolean tracking) |
Enable or disable focus tracking mode.
|
boolean |
trackMouse(Terminal.MouseTracking tracking) |
Change the mouse tracking mouse.
|
PrintWriter |
writer() |
Retrieve the
Writer for this terminal. |
static final String TYPE_DUMB
static final String TYPE_DUMB_COLOR
String getName()
Terminal.SignalHandler handle(Terminal.Signal signal, Terminal.SignalHandler handler)
void raise(Terminal.Signal signal)
NonBlockingReader reader()
Reader
for this terminal.
This is the standard way to read input from this terminal.
The reader is non blocking.PrintWriter writer()
Writer
for this terminal.
This is the standard way to write to this terminal.Charset encoding()
InputStream input()
reader()
instead.reader()
OutputStream output()
writer()
instead.writer()
boolean canPauseResume()
void pause(boolean wait) throws InterruptedException
wait
- true
to wait until the terminal is actually pausedInterruptedException
- if the call has been interruptedboolean paused()
Attributes enterRawMode()
boolean echo()
boolean echo(boolean echo)
Attributes getAttributes()
void setAttributes(Attributes attr)
Size getSize()
getBufferSize()
void setSize(Size size)
default int getWidth()
default int getHeight()
default Size getBufferSize()
getBufferSize()
method
can be used to avoid wrapping when using the terminal in a line
editing mode, while the getSize()
method should be
used when using full screen mode.getSize()
String getType()
boolean puts(InfoCmp.Capability capability, Object... params)
boolean getBooleanCapability(InfoCmp.Capability capability)
Integer getNumericCapability(InfoCmp.Capability capability)
String getStringCapability(InfoCmp.Capability capability)
Cursor getCursorPosition(IntConsumer discarded)
org.jline.keymap.BindingReader#runMacro(String)
discarded
- a consumer receiving discarded charactersnull
if cursor position reporting
is not supported or a valid cursor positionboolean hasMouseSupport()
true
if the terminal has support for mouse.trackMouse(MouseTracking)
boolean trackMouse(Terminal.MouseTracking tracking)
InfoCmp.Capability.key_mouse
to the input stream.
When this character sequence is detected, the readMouseEvent()
method can be
called to actually read the corresponding mouse event.tracking
- the mouse tracking modetrue
if mouse tracking is supportedMouseEvent readMouseEvent()
InfoCmp.Capability.key_mouse
in the stream immediately before reading the event.trackMouse(MouseTracking)
MouseEvent readMouseEvent(IntSupplier reader)
reader
- the input supplierboolean hasFocusSupport()
true
if the terminal has support for focus tracking.trackFocus(boolean)
boolean trackFocus(boolean tracking)
tracking
- whether the focus tracking mode should be enabled or nottrue
if focus tracking is supportedCopyright © 2020. All rights reserved.