- java.lang.Object
-
- All Implemented Interfaces:
Scrollable
,InputProvider
,ExtendedTerminal
,Terminal
,java.io.Closeable
,java.lang.AutoCloseable
public class UnixTerminal extends UnixLikeTTYTerminal
This class extends UnixLikeTerminal and implements the Unix-specific parts.If you need to have Lanterna to call stty at a different location, you'll need to subclass this and override
getSTTYCommand()
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.googlecode.lanterna.terminal.ansi.UnixLikeTerminal
UnixLikeTerminal.CtrlCBehaviour
-
-
Constructor Summary
Constructors Modifier Constructor Description UnixTerminal()
Creates a UnixTerminal with default settings, using System.in and System.out for input/output, using the default character set on the system as the encoding and trap ctrl+c signal instead of killing the application.private
UnixTerminal(java.io.File terminalDevice, java.io.InputStream terminalInput, java.io.OutputStream terminalOutput, java.nio.charset.Charset terminalCharset, UnixLikeTerminal.CtrlCBehaviour terminalCtrlCBehaviour)
UnixTerminal(java.io.InputStream terminalInput, java.io.OutputStream terminalOutput, java.nio.charset.Charset terminalCharset)
Creates a UnixTerminal using a specified input stream, output stream and character set.UnixTerminal(java.io.InputStream terminalInput, java.io.OutputStream terminalOutput, java.nio.charset.Charset terminalCharset, UnixLikeTerminal.CtrlCBehaviour terminalCtrlCBehaviour)
Creates a UnixTerminal using a specified input stream, output stream and character set, with a custom size querier instead of using the default one.
-
Method Summary
-
Methods inherited from class com.googlecode.lanterna.terminal.ansi.UnixLikeTTYTerminal
acquire, canonicalMode, exec, keyEchoEnabled, keyStrokeSignalsEnabled, registerTerminalResizeListener, restoreTerminalSettings, runSTTYCommand, saveTerminalSettings
-
Methods inherited from class com.googlecode.lanterna.terminal.ansi.UnixLikeTerminal
close, getTerminalCtrlCBehaviour, pollInput, readInput
-
Methods inherited from class com.googlecode.lanterna.terminal.ansi.ANSITerminal
clearScreen, deiconify, disableSGR, enableSGR, enterPrivateMode, exitPrivateMode, findTerminalSize, getCursorPosition, getDefaultKeyDecodingProfile, getTerminalSize, iconify, isInPrivateMode, maximize, popTitle, pushTitle, reportPosition, resetColorAndSGR, restoreCursorPosition, saveCursorPosition, scrollLines, setBackgroundColor, setCursorPosition, setCursorPosition, setCursorVisible, setForegroundColor, setMouseCaptureMode, setTerminalSize, setTitle, unmaximize
-
Methods inherited from class com.googlecode.lanterna.terminal.ansi.StreamBasedTerminal
bell, enquireTerminal, flush, getCharset, getInputDecoder, putCharacter, putString, resetMemorizedCursorPosition, translateCharacter, waitForCursorPositionReport, writeToTerminal
-
Methods inherited from class com.googlecode.lanterna.terminal.AbstractTerminal
addResizeListener, newTextGraphics, onResized, onResized, removeResizeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.googlecode.lanterna.terminal.Terminal
addResizeListener, bell, enquireTerminal, flush, newTextGraphics, putCharacter, putString, removeResizeListener
-
-
-
-
Constructor Detail
-
UnixTerminal
public UnixTerminal() throws java.io.IOException
Creates a UnixTerminal with default settings, using System.in and System.out for input/output, using the default character set on the system as the encoding and trap ctrl+c signal instead of killing the application.- Throws:
java.io.IOException
- If there was an I/O error initializing the terminal
-
UnixTerminal
public UnixTerminal(java.io.InputStream terminalInput, java.io.OutputStream terminalOutput, java.nio.charset.Charset terminalCharset) throws java.io.IOException
Creates a UnixTerminal using a specified input stream, output stream and character set. Ctrl+c signal will be trapped instead of killing the application.- Parameters:
terminalInput
- Input stream to read terminal input fromterminalOutput
- Output stream to write terminal output toterminalCharset
- Character set to use when converting characters to bytes- Throws:
java.io.IOException
- If there was an I/O error initializing the terminal
-
UnixTerminal
public UnixTerminal(java.io.InputStream terminalInput, java.io.OutputStream terminalOutput, java.nio.charset.Charset terminalCharset, UnixLikeTerminal.CtrlCBehaviour terminalCtrlCBehaviour) throws java.io.IOException
Creates a UnixTerminal using a specified input stream, output stream and character set, with a custom size querier instead of using the default one. This way you can override size detection (if you want to force the terminal to a fixed size, for example). You also choose how you want ctrl+c key strokes to be handled.- Parameters:
terminalInput
- Input stream to read terminal input fromterminalOutput
- Output stream to write terminal output toterminalCharset
- Character set to use when converting characters to bytesterminalCtrlCBehaviour
- Special settings on how the terminal will behave, seeUnixTerminalMode
for more details- Throws:
java.io.IOException
- If there was an I/O error initializing the terminal
-
UnixTerminal
private UnixTerminal(java.io.File terminalDevice, java.io.InputStream terminalInput, java.io.OutputStream terminalOutput, java.nio.charset.Charset terminalCharset, UnixLikeTerminal.CtrlCBehaviour terminalCtrlCBehaviour) throws java.io.IOException
- Throws:
java.io.IOException
-
-