Package org.jline.terminal.impl
Class AbstractPosixTerminal
- java.lang.Object
-
- org.jline.terminal.impl.AbstractTerminal
-
- org.jline.terminal.impl.AbstractPosixTerminal
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
,TerminalExt
,Terminal
- Direct Known Subclasses:
PosixPtyTerminal
,PosixSysTerminal
public abstract class AbstractPosixTerminal extends AbstractTerminal
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jline.terminal.Terminal
Terminal.MouseTracking, Terminal.Signal, Terminal.SignalHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected Attributes
originalAttributes
protected Pty
pty
-
Fields inherited from class org.jline.terminal.impl.AbstractTerminal
bools, encoding, handlers, ints, name, onClose, palette, status, strings, type
-
Fields inherited from interface org.jline.terminal.Terminal
TYPE_DUMB, TYPE_DUMB_COLOR
-
-
Constructor Summary
Constructors Constructor Description AbstractPosixTerminal(java.lang.String name, java.lang.String type, Pty pty)
AbstractPosixTerminal(java.lang.String name, java.lang.String type, Pty pty, java.nio.charset.Charset encoding, Terminal.SignalHandler signalHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doClose()
Attributes
getAttributes()
Returns the terminal attributes.Cursor
getCursorPosition(java.util.function.IntConsumer discarded)
Query the terminal to report the cursor position.TerminalProvider
getProvider()
Returns theTerminalProvider
that created this terminal ornull
if the terminal was created with no provider.Pty
getPty()
Size
getSize()
Retrieve the size of the visible windowSystemStream
getSystemStream()
The underlying system stream, may beSystemStream.Output
,SystemStream.Error
, ornull
if this terminal is not bound to a system stream.void
setAttributes(Attributes attr)
Set the terminal attributes.void
setSize(Size size)
java.lang.String
toString()
-
Methods inherited from class org.jline.terminal.impl.AbstractTerminal
canPauseResume, checkInterrupted, close, echo, echo, echoSignal, encoding, enterRawMode, flush, getBooleanCapability, getKind, getName, getNumericCapability, getPalette, getStatus, getStatus, getStringCapability, getType, handle, hasFocusSupport, hasMouseSupport, parseInfoCmp, pause, pause, paused, puts, raise, readMouseEvent, readMouseEvent, resume, setOnClose, trackFocus, trackMouse
-
-
-
-
Field Detail
-
pty
protected final Pty pty
-
originalAttributes
protected final Attributes originalAttributes
-
-
Constructor Detail
-
AbstractPosixTerminal
public AbstractPosixTerminal(java.lang.String name, java.lang.String type, Pty pty) throws java.io.IOException
- Throws:
java.io.IOException
-
AbstractPosixTerminal
public AbstractPosixTerminal(java.lang.String name, java.lang.String type, Pty pty, java.nio.charset.Charset encoding, Terminal.SignalHandler signalHandler) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getPty
public Pty getPty()
-
getAttributes
public Attributes getAttributes()
Description copied from interface:Terminal
Returns the terminal attributes. The returned object can be safely modified further used in a call toTerminal.setAttributes(Attributes)
.- Returns:
- the terminal attributes.
-
setAttributes
public void setAttributes(Attributes attr)
Description copied from interface:Terminal
Set the terminal attributes. The terminal will perform a copy of the given attributes.- Parameters:
attr
- the new attributes
-
getSize
public Size getSize()
Description copied from interface:Terminal
Retrieve the size of the visible window- Returns:
- the visible terminal size
- See Also:
Terminal.getBufferSize()
-
setSize
public void setSize(Size size)
-
doClose
protected void doClose() throws java.io.IOException
- Overrides:
doClose
in classAbstractTerminal
- Throws:
java.io.IOException
-
getCursorPosition
public Cursor getCursorPosition(java.util.function.IntConsumer discarded)
Description copied from interface:Terminal
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 usingorg.jline.keymap.BindingReader#runMacro(String)
- Specified by:
getCursorPosition
in interfaceTerminal
- Overrides:
getCursorPosition
in classAbstractTerminal
- Parameters:
discarded
- a consumer receiving discarded characters- Returns:
null
if cursor position reporting is not supported or a valid cursor position
-
getProvider
public TerminalProvider getProvider()
Description copied from interface:TerminalExt
Returns theTerminalProvider
that created this terminal ornull
if the terminal was created with no provider.
-
getSystemStream
public SystemStream getSystemStream()
Description copied from interface:TerminalExt
The underlying system stream, may beSystemStream.Output
,SystemStream.Error
, ornull
if this terminal is not bound to a system stream.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classAbstractTerminal
-
-