- java.lang.Object
-
- org.jline.terminal.impl.AbstractTerminal
-
- org.jline.terminal.impl.AbstractPosixTerminal
-
- org.jline.terminal.impl.PosixPtyTerminal
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,Terminal
public class PosixPtyTerminal extends AbstractPosixTerminal
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jline.terminal.Terminal
Terminal.MouseTracking, Terminal.Signal, Terminal.SignalHandler
-
-
Field Summary
-
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 PosixPtyTerminal(String name, String type, Pty pty, InputStream in, OutputStream out, Charset encoding)PosixPtyTerminal(String name, String type, Pty pty, InputStream in, OutputStream out, Charset encoding, Terminal.SignalHandler signalHandler)PosixPtyTerminal(String name, String type, Pty pty, InputStream in, OutputStream out, Charset encoding, Terminal.SignalHandler signalHandler, boolean paused)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanPauseResume()Whether this terminal supportsTerminal.pause()andTerminal.resume()calls.protected voiddoClose()InputStreaminput()Retrieve the input stream for this terminal.OutputStreamoutput()Retrieve the output stream for this terminal.voidpause()Stop reading the input stream.voidpause(boolean wait)Stop reading the input stream and optionally wait for the underlying threads to finish.booleanpaused()Check whether the terminal is currently reading the input stream or not.NonBlockingReaderreader()Retrieve theReaderfor this terminal.voidresume()Resume reading the input stream.PrintWriterwriter()Retrieve theWriterfor this terminal.-
Methods inherited from class org.jline.terminal.impl.AbstractPosixTerminal
getAttributes, getCursorPosition, getPty, getSize, setAttributes, setSize
-
Methods inherited from class org.jline.terminal.impl.AbstractTerminal
checkInterrupted, close, echo, echo, echoSignal, encoding, enterRawMode, flush, getBooleanCapability, getKind, getName, getNumericCapability, getPalette, getStatus, getStatus, getStringCapability, getType, handle, hasFocusSupport, hasMouseSupport, parseInfoCmp, puts, raise, readMouseEvent, readMouseEvent, setOnClose, trackFocus, trackMouse
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jline.terminal.Terminal
getBufferSize, getHeight, getWidth
-
-
-
-
Constructor Detail
-
PosixPtyTerminal
public PosixPtyTerminal(String name, String type, Pty pty, InputStream in, OutputStream out, Charset encoding) throws IOException
- Throws:
IOException
-
PosixPtyTerminal
public PosixPtyTerminal(String name, String type, Pty pty, InputStream in, OutputStream out, Charset encoding, Terminal.SignalHandler signalHandler) throws IOException
- Throws:
IOException
-
PosixPtyTerminal
public PosixPtyTerminal(String name, String type, Pty pty, InputStream in, OutputStream out, Charset encoding, Terminal.SignalHandler signalHandler, boolean paused) throws IOException
- Throws:
IOException
-
-
Method Detail
-
input
public InputStream input()
Description copied from interface:TerminalRetrieve 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()
-
reader
public NonBlockingReader reader()
Description copied from interface:TerminalRetrieve theReaderfor this terminal. This is the standard way to read input from this terminal. The reader is non blocking.- Returns:
- The non blocking reader
-
output
public OutputStream output()
Description copied from interface:TerminalRetrieve 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()
-
writer
public PrintWriter writer()
Description copied from interface:TerminalRetrieve theWriterfor this terminal. This is the standard way to write to this terminal.- Returns:
- The writer
-
doClose
protected void doClose() throws IOException- Overrides:
doClosein classAbstractPosixTerminal- Throws:
IOException
-
canPauseResume
public boolean canPauseResume()
Description copied from interface:TerminalWhether this terminal supportsTerminal.pause()andTerminal.resume()calls.- Specified by:
canPauseResumein interfaceTerminal- Overrides:
canPauseResumein classAbstractTerminal- Returns:
- whether this terminal supports
Terminal.pause()andTerminal.resume()calls. - See Also:
Terminal.paused(),Terminal.pause(),Terminal.resume()
-
pause
public void pause()
Description copied from interface:TerminalStop reading the input stream.- Specified by:
pausein interfaceTerminal- Overrides:
pausein classAbstractTerminal- See Also:
Terminal.resume(),Terminal.paused()
-
pause
public void pause(boolean wait) throws InterruptedExceptionDescription copied from interface:TerminalStop reading the input stream and optionally wait for the underlying threads to finish.- Specified by:
pausein interfaceTerminal- Overrides:
pausein classAbstractTerminal- Parameters:
wait-trueto wait until the terminal is actually paused- Throws:
InterruptedException- if the call has been interrupted
-
resume
public void resume()
Description copied from interface:TerminalResume reading the input stream.- Specified by:
resumein interfaceTerminal- Overrides:
resumein classAbstractTerminal- See Also:
Terminal.pause(),Terminal.paused()
-
paused
public boolean paused()
Description copied from interface:TerminalCheck 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.- Specified by:
pausedin interfaceTerminal- Overrides:
pausedin classAbstractTerminal- Returns:
- whether the terminal is currently reading the input stream or not
- See Also:
Terminal.pause(),Terminal.resume()
-
-