APIdia Launch Partner
Top Fields Constructors Methods
jdk.internal.org.jline.terminal.impl

public abstract Class AbstractTerminal

extends Object
implements TerminalExt
Class Inheritance
All Implemented Interfaces
jdk.internal.org.jline.terminal.spi.TerminalExt, jdk.internal.org.jline.terminal.Terminal, java.io.Flushable, java.io.Closeable, java.lang.AutoCloseable
Known Direct Subclasses
jdk.internal.org.jline.terminal.impl.AbstractWindowsTerminal, jdk.internal.org.jline.terminal.impl.DumbTerminal, jdk.internal.org.jline.terminal.impl.LineDisciplineTerminal, jdk.internal.org.jline.terminal.impl.AbstractPosixTerminal
Imports
java.io.IOException, .InterruptedIOException, java.nio.charset.Charset, java.util.EnumSet, .HashMap, .HashSet, .Map, .Objects, .Set, java.util.concurrent.ConcurrentHashMap, java.util.function.IntConsumer, .IntSupplier, jdk.internal.org.jline.terminal.Attributes, .Attributes.ControlChar, .Attributes.InputFlag, .Attributes.LocalFlag, .Cursor, .MouseEvent, jdk.internal.org.jline.terminal.spi.TerminalExt, jdk.internal.org.jline.utils.ColorPalette, .Curses, .InfoCmp, .InfoCmp.Capability, .Log, .Status

Field Summary

Modifier and TypeField and Description
protected final Set<InfoCmp.Capability>
protected final Charset
protected final Map<Terminal.Signal, Terminal.SignalHandler>
protected final Map<InfoCmp.Capability, Integer>
private MouseEvent
protected final String
protected Runnable
protected final ColorPalette
protected Status
protected final Map<InfoCmp.Capability, String>
protected final String

Constructor Summary

AccessConstructor and Description
public
public
AbstractTerminal(String name, String type, Charset encoding, Terminal.SignalHandler signalHandler)

Method Summary

Modifier and TypeMethod and Description
public boolean
canPauseResume()

Implements jdk.internal.org.jline.terminal.Terminal.canPauseResume.

Whether this terminal supports pause() and resume() calls.

protected void
public final void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

protected void
public boolean
public boolean
protected void
public Charset
encoding()

Implements jdk.internal.org.jline.terminal.Terminal.encoding.

Returns the Charset that should be used to encode characters for input() and output().

public Attributes
public void
flush()

Implements jdk.internal.org.jline.terminal.Terminal.flush.

Flushes this stream by writing any buffered output to the underlying stream.

public boolean
public Cursor
getCursorPosition(IntConsumer discarded)

Implements jdk.internal.org.jline.terminal.Terminal.getCursorPosition.

Query the terminal to report the cursor position.

public String
public String
public Integer
public ColorPalette
public Status
public Status
getStatus(boolean create)

public String
public String
public Terminal.SignalHandler
handle(Terminal.Signal signal, Terminal.SignalHandler handler)

Implements jdk.internal.org.jline.terminal.Terminal.handle.

Registers a handler for the given Signal.

public boolean
hasFocusSupport()

Implements jdk.internal.org.jline.terminal.Terminal.hasFocusSupport.

Returns true if the terminal has support for focus tracking.

public boolean
hasMouseSupport()

Implements jdk.internal.org.jline.terminal.Terminal.hasMouseSupport.

Returns true if the terminal has support for mouse.

protected void
public void
pause()

Implements jdk.internal.org.jline.terminal.Terminal.pause.

Stop reading the input stream.

public void
pause(boolean wait)

Implements jdk.internal.org.jline.terminal.Terminal.pause.

Stop reading the input stream and optionally wait for the underlying threads to finish.

public boolean
paused()

Implements jdk.internal.org.jline.terminal.Terminal.paused.

Check whether the terminal is currently reading the input stream or not.

public boolean
public void
raise(Terminal.Signal signal)

Implements jdk.internal.org.jline.terminal.Terminal.raise.

Raise the specific signal.

public MouseEvent
readMouseEvent()

Implements jdk.internal.org.jline.terminal.Terminal.readMouseEvent.

Read a MouseEvent from the terminal input stream.

public MouseEvent
readMouseEvent(IntSupplier reader)

Implements jdk.internal.org.jline.terminal.Terminal.readMouseEvent.

Read a MouseEvent from the given input stream.

public void
resume()

Implements jdk.internal.org.jline.terminal.Terminal.resume.

Resume reading the input stream.

public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public boolean
trackFocus(boolean tracking)

Implements jdk.internal.org.jline.terminal.Terminal.trackFocus.

Enable or disable focus tracking mode.

public boolean
trackMouse(Terminal.MouseTracking tracking)

Implements jdk.internal.org.jline.terminal.Terminal.trackMouse.

Change the mouse tracking mouse.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

boolsback to summary
protected final Set<InfoCmp.Capability> bools
encodingback to summary
protected final Charset encoding
handlersback to summary
protected final Map<Terminal.Signal, Terminal.SignalHandler> handlers
intsback to summary
protected final Map<InfoCmp.Capability, Integer> ints
lastMouseEventback to summary
private MouseEvent lastMouseEvent
nameback to summary
protected final String name
onCloseback to summary
protected Runnable onClose
paletteback to summary
protected final ColorPalette palette
statusback to summary
protected Status status
stringsback to summary
protected final Map<InfoCmp.Capability, String> strings
typeback to summary
protected final String type

Constructor Detail

AbstractTerminalback to summary
public AbstractTerminal(String name, String type) throws IOException
AbstractTerminalback to summary
public AbstractTerminal(String name, String type, Charset encoding, Terminal.SignalHandler signalHandler) throws IOException
Annotations
@SuppressWarnings:this-escape

Method Detail

canPauseResumeback to summary
public boolean canPauseResume()

Implements jdk.internal.org.jline.terminal.Terminal.canPauseResume.

Doc from jdk.internal.org.jline.terminal.Terminal.canPauseResume.

Whether this terminal supports pause() and resume() calls.

Annotations
@Override
checkInterruptedback to summary
protected void checkInterrupted() throws InterruptedIOException
closeback to summary
public final void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Exceptions
IOException:
if an I/O error occurs
doCloseback to summary
protected void doClose() throws IOException
echoback to summary
public boolean echo()

Implements jdk.internal.org.jline.terminal.Terminal.echo.

echoback to summary
public boolean echo(boolean echo)

Implements jdk.internal.org.jline.terminal.Terminal.echo.

echoSignalback to summary
protected void echoSignal(Terminal.Signal signal)
encodingback to summary
public Charset encoding()

Implements jdk.internal.org.jline.terminal.Terminal.encoding.

Doc from jdk.internal.org.jline.terminal.Terminal.encoding.

Returns the Charset that should be used to encode characters for input() and output().

Annotations
@Override
enterRawModeback to summary
public Attributes enterRawMode()

Implements jdk.internal.org.jline.terminal.Terminal.enterRawMode.

flushback to summary
public void flush()

Implements jdk.internal.org.jline.terminal.Terminal.flush.

Doc from java.io.Flushable.flush.

Flushes this stream by writing any buffered output to the underlying stream.

getBooleanCapabilityback to summary
public boolean getBooleanCapability(InfoCmp.Capability capability)

Implements jdk.internal.org.jline.terminal.Terminal.getBooleanCapability.

getCursorPositionback to summary
public Cursor getCursorPosition(IntConsumer discarded)

Implements jdk.internal.org.jline.terminal.Terminal.getCursorPosition.

Doc from jdk.internal.org.jline.terminal.Terminal.getCursorPosition.

Query the terminal to report the cursor position. As the response is read from the input stream, some characters may be read before the cursor position is actually read. Those characters can be given back using org.jline.keymap.BindingReader#runMacro(String)

Annotations
@Override
getKindback to summary
public String getKind()
getNameback to summary
public String getName()

Implements jdk.internal.org.jline.terminal.Terminal.getName.

getNumericCapabilityback to summary
public Integer getNumericCapability(InfoCmp.Capability capability)

Implements jdk.internal.org.jline.terminal.Terminal.getNumericCapability.

getPaletteback to summary
public ColorPalette getPalette()

Implements jdk.internal.org.jline.terminal.Terminal.getPalette.

Doc from jdk.internal.org.jline.terminal.Terminal.getPalette.

Color support

Annotations
@Override
getStatusback to summary
public Status getStatus()
getStatusback to summary
public Status getStatus(boolean create)
getStringCapabilityback to summary
public String getStringCapability(InfoCmp.Capability capability)

Implements jdk.internal.org.jline.terminal.Terminal.getStringCapability.

getTypeback to summary
public String getType()

Implements jdk.internal.org.jline.terminal.Terminal.getType.

handleback to summary
public Terminal.SignalHandler handle(Terminal.Signal signal, Terminal.SignalHandler handler)

Implements jdk.internal.org.jline.terminal.Terminal.handle.

Doc from jdk.internal.org.jline.terminal.Terminal.handle.

Registers a handler for the given Signal.

Note that the JVM does not easily allow catching the Signal#QUIT signal, which causes a thread dump to be displayed. This signal is mainly used when connecting through an SSH socket to a virtual terminal.

hasFocusSupportback to summary
public boolean hasFocusSupport()

Implements jdk.internal.org.jline.terminal.Terminal.hasFocusSupport.

Doc from jdk.internal.org.jline.terminal.Terminal.hasFocusSupport.

Returns true if the terminal has support for focus tracking.

Annotations
@Override
hasMouseSupportback to summary
public boolean hasMouseSupport()

Implements jdk.internal.org.jline.terminal.Terminal.hasMouseSupport.

Doc from jdk.internal.org.jline.terminal.Terminal.hasMouseSupport.

Returns true if the terminal has support for mouse.

Annotations
@Override
parseInfoCmpback to summary
protected void parseInfoCmp()
pauseback to summary
public void pause()

Implements jdk.internal.org.jline.terminal.Terminal.pause.

Doc from jdk.internal.org.jline.terminal.Terminal.pause.

Stop reading the input stream.

Annotations
@Override
pauseback to summary
public void pause(boolean wait) throws InterruptedException

Implements jdk.internal.org.jline.terminal.Terminal.pause.

Doc from jdk.internal.org.jline.terminal.Terminal.pause.

Stop reading the input stream and optionally wait for the underlying threads to finish.

Annotations
@Override
Exceptions
InterruptedException:
if the call has been interrupted
pausedback to summary
public boolean paused()

Implements jdk.internal.org.jline.terminal.Terminal.paused.

Doc from jdk.internal.org.jline.terminal.Terminal.paused.

Check whether the terminal is currently reading the input stream or not. In order to process signal as quickly as possible, the terminal need to read the input stream and buffer it internally so that it can detect specific characters in the input stream (Ctrl+C, Ctrl+D, etc...) and raise the appropriate signals. However, there are some cases where this processing should be disabled, for example when handing the terminal control to a subprocess.

Annotations
@Override
putsback to summary
public boolean puts(InfoCmp.Capability capability, Object... params)

Implements jdk.internal.org.jline.terminal.Terminal.puts.

raiseback to summary
public void raise(Terminal.Signal signal)

Implements jdk.internal.org.jline.terminal.Terminal.raise.

Doc from jdk.internal.org.jline.terminal.Terminal.raise.

Raise the specific signal. This is not method usually called by non system terminals. When accessing a terminal through a SSH or Telnet connection, signals may be conveyed by the protocol and thus need to be raised when reaching the terminal code. The terminals do that automatically when the terminal input stream has a character mapped to Attributes.ControlChar#VINTR, Attributes.ControlChar#VQUIT, or Attributes.ControlChar#VSUSP.

readMouseEventback to summary
public MouseEvent readMouseEvent()

Implements jdk.internal.org.jline.terminal.Terminal.readMouseEvent.

Doc from jdk.internal.org.jline.terminal.Terminal.readMouseEvent.

Read a MouseEvent from the terminal input stream. Such an event must have been detected by scanning the terminal's Capability#key_mouse in the stream immediately before reading the event.

Annotations
@Override
readMouseEventback to summary
public MouseEvent readMouseEvent(IntSupplier reader)

Implements jdk.internal.org.jline.terminal.Terminal.readMouseEvent.

Doc from jdk.internal.org.jline.terminal.Terminal.readMouseEvent.

Read a MouseEvent from the given input stream.

Annotations
@Override
resumeback to summary
public void resume()

Implements jdk.internal.org.jline.terminal.Terminal.resume.

Doc from jdk.internal.org.jline.terminal.Terminal.resume.

Resume reading the input stream.

Annotations
@Override
setOnCloseback to summary
public void setOnClose(Runnable onClose)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
trackFocusback to summary
public boolean trackFocus(boolean tracking)

Implements jdk.internal.org.jline.terminal.Terminal.trackFocus.

Doc from jdk.internal.org.jline.terminal.Terminal.trackFocus.

Enable or disable focus tracking mode. When focus tracking has been activated, each time the terminal grabs the focus, the string "\33[I" will be sent to the input stream and each time the focus is lost, the string "\33[O" will be sent to the input stream.

Annotations
@Override
trackMouseback to summary
public boolean trackMouse(Terminal.MouseTracking tracking)

Implements jdk.internal.org.jline.terminal.Terminal.trackMouse.

Doc from jdk.internal.org.jline.terminal.Terminal.trackMouse.

Change the mouse tracking mouse. To start mouse tracking, this method must be called with a valid mouse tracking mode. Mouse events will be reported by writing the 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.

Annotations
@Override