Package org.jline.terminal.impl
Class PosixSysTerminal
- java.lang.Object
-
- org.jline.terminal.impl.AbstractTerminal
-
- org.jline.terminal.impl.AbstractPosixTerminal
-
- org.jline.terminal.impl.PosixSysTerminal
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
,TerminalExt
,Terminal
public class PosixSysTerminal extends AbstractPosixTerminal
-
-
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 ShutdownHooks.Task
closer
protected NonBlockingInputStream
input
protected java.util.Map<Terminal.Signal,java.lang.Object>
nativeHandlers
protected java.io.OutputStream
output
protected NonBlockingReader
reader
protected java.io.PrintWriter
writer
-
Fields inherited from class org.jline.terminal.impl.AbstractPosixTerminal
originalAttributes, 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 PosixSysTerminal(java.lang.String name, java.lang.String type, Pty pty, java.nio.charset.Charset encoding, boolean nativeSignals, Terminal.SignalHandler signalHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doClose()
Terminal.SignalHandler
handle(Terminal.Signal signal, Terminal.SignalHandler handler)
Registers a handler for the givenTerminal.Signal
.java.io.InputStream
input()
Retrieve the input stream for this terminal.java.io.OutputStream
output()
Retrieve the output stream for this terminal.NonBlockingReader
reader()
Retrieve theReader
for this terminal.java.io.PrintWriter
writer()
Retrieve theWriter
for this terminal.-
Methods inherited from class org.jline.terminal.impl.AbstractPosixTerminal
getAttributes, getCursorPosition, getProvider, getPty, getSize, getSystemStream, setAttributes, setSize, 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, hasFocusSupport, hasMouseSupport, parseInfoCmp, pause, pause, paused, puts, raise, readMouseEvent, readMouseEvent, resume, setOnClose, trackFocus, trackMouse
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jline.terminal.Terminal
getBufferSize, getHeight, getWidth
-
-
-
-
Field Detail
-
input
protected final NonBlockingInputStream input
-
output
protected final java.io.OutputStream output
-
reader
protected final NonBlockingReader reader
-
writer
protected final java.io.PrintWriter writer
-
nativeHandlers
protected final java.util.Map<Terminal.Signal,java.lang.Object> nativeHandlers
-
closer
protected final ShutdownHooks.Task closer
-
-
Constructor Detail
-
PosixSysTerminal
public PosixSysTerminal(java.lang.String name, java.lang.String type, Pty pty, java.nio.charset.Charset encoding, boolean nativeSignals, Terminal.SignalHandler signalHandler) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
handle
public Terminal.SignalHandler handle(Terminal.Signal signal, Terminal.SignalHandler handler)
Description copied from interface:Terminal
Registers a handler for the givenTerminal.Signal
.Note that the JVM does not easily allow catching the
Terminal.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.- Specified by:
handle
in interfaceTerminal
- Overrides:
handle
in classAbstractTerminal
- Parameters:
signal
- the signal to register a handler forhandler
- the handler- Returns:
- the previous signal handler
-
reader
public NonBlockingReader reader()
Description copied from interface:Terminal
Retrieve theReader
for this terminal. This is the standard way to read input from this terminal. The reader is non blocking.- Returns:
- The non blocking reader
-
writer
public java.io.PrintWriter writer()
Description copied from interface:Terminal
Retrieve theWriter
for this terminal. This is the standard way to write to this terminal.- Returns:
- The writer
-
input
public java.io.InputStream input()
Description copied from interface:Terminal
Retrieve the input stream for this terminal. In some rare cases, there may be a need to access the terminal input stream directly. In the usual cases, use theTerminal.reader()
instead.- Returns:
- The input stream
- See Also:
Terminal.reader()
-
output
public java.io.OutputStream output()
Description copied from interface:Terminal
Retrieve the output stream for this terminal. In some rare cases, there may be a need to access the terminal output stream directly. In the usual cases, use theTerminal.writer()
instead.- Returns:
- The output stream
- See Also:
Terminal.writer()
-
doClose
protected void doClose() throws java.io.IOException
- Overrides:
doClose
in classAbstractPosixTerminal
- Throws:
java.io.IOException
-
-