public class UnixTerminal extends ANSITerminal
Modifier and Type | Class and Description |
---|---|
static class |
UnixTerminal.Behaviour
This enum lets you control some more low-level behaviors of this terminal object.
|
Terminal.Color, Terminal.ResizeListener, Terminal.SGR
writerMutex
Constructor and Description |
---|
UnixTerminal(InputStream terminalInput,
OutputStream terminalOutput,
Charset terminalCharset)
Creates a UnixTerminal using a specified input stream, output stream and character set.
|
UnixTerminal(InputStream terminalInput,
OutputStream terminalOutput,
Charset terminalCharset,
UnixTerminalSizeQuerier customSizeQuerier)
Creates a UnixTerminal using a specified input stream, output stream and character set.
|
UnixTerminal(InputStream terminalInput,
OutputStream terminalOutput,
Charset terminalCharset,
UnixTerminalSizeQuerier customSizeQuerier,
UnixTerminal.Behaviour terminalBehaviour)
Creates a UnixTerminal using a specified input stream, output stream and character set.
|
Modifier and Type | Method and Description |
---|---|
void |
enterPrivateMode()
Calling this method will, where supported, give your terminal a private
area to use, separate from what was there before.
|
void |
exitPrivateMode()
If you have previously entered private mode, this method will exit this
and, depending on implementation, maybe restore what the terminal looked
like before private mode was entered.
|
TerminalSize |
getTerminalSize()
Returns the size of the terminal, expressed as a
TerminalSize
object. |
TerminalSize |
queryTerminalSize()
Deprecated.
|
Key |
readInput()
Returns the next
Key off the input queue or null if there is none
more input events available |
void |
setCBreak(boolean cbreakOn)
Enabling cbreak mode will allow you to read user input immediately as the
user enters the characters, as opposed to reading the data in lines as
the user presses enter.
|
void |
setEcho(boolean echoOn)
Enables or disables keyboard echo, meaning the immediate output of the
characters you type on your keyboard.
|
applyBackgroundColor, applyBackgroundColor, applyBackgroundColor, applyForegroundColor, applyForegroundColor, applyForegroundColor, applySGR, clearScreen, moveCursor, reportPosition, restoreCursorPosition, saveCursorPosition, setCursorVisible
flush, putCharacter, translateCharacter, writeToTerminal
addInputProfile, waitForTerminalSizeReport
addResizeListener, getLastKnownSize, onResized, removeResizeListener
public UnixTerminal(InputStream terminalInput, OutputStream terminalOutput, Charset terminalCharset)
terminalInput
- Input stream to read terminal input fromterminalOutput
- Output stream to write terminal output toterminalCharset
- Character set to use when converting characters to bytespublic UnixTerminal(InputStream terminalInput, OutputStream terminalOutput, Charset terminalCharset, UnixTerminalSizeQuerier customSizeQuerier)
terminalInput
- Input stream to read terminal input fromterminalOutput
- Output stream to write terminal output toterminalCharset
- Character set to use when converting characters to bytescustomSizeQuerier
- Object to use for looking up the size of the terminal, or null to
use the built-in methodpublic UnixTerminal(InputStream terminalInput, OutputStream terminalOutput, Charset terminalCharset, UnixTerminalSizeQuerier customSizeQuerier, UnixTerminal.Behaviour terminalBehaviour)
terminalInput
- Input stream to read terminal input fromterminalOutput
- Output stream to write terminal output toterminalCharset
- Character set to use when converting characters to bytescustomSizeQuerier
- Object to use for looking up the size of the terminal, or null to
use the built-in methodterminalBehaviour
- Special settings on how the terminal will behave, see
UnixTerminalMode
for more details@Deprecated public TerminalSize queryTerminalSize()
Terminal
TerminalSize
object. Please note that the default way of figuring
this information out is asynchorous and so you will be given the last
known dimensions. With proper resize listeners set up, this will only be
a problem for figuring out the initial size of the terminal.queryTerminalSize
in interface Terminal
queryTerminalSize
in class ANSITerminal
TerminalSize
object representing the size of the terminalTerminalSize
public TerminalSize getTerminalSize()
Terminal
TerminalSize
object. Please bear in mind that depending on the Terminal
implementation, this may or may not be accurate. See the implementing
classes for more information.getTerminalSize
in interface Terminal
getTerminalSize
in class ANSITerminal
public Key readInput()
InputProvider
Key
off the input queue or null if there is none
more input events availablereadInput
in interface InputProvider
readInput
in class InputEnabledAbstractTerminal
Key
off the input queue or null if there is nonepublic void enterPrivateMode()
Terminal
enterPrivateMode
in interface Terminal
enterPrivateMode
in class ANSITerminal
public void exitPrivateMode()
Terminal
exitPrivateMode
in interface Terminal
exitPrivateMode
in class ANSITerminal
public void setCBreak(boolean cbreakOn)
ANSITerminal
setCBreak
in class ANSITerminal
public void setEcho(boolean echoOn)
ANSITerminal
setEcho
in class ANSITerminal
echoOn
- true if keyboard input will immediately echo, false if it's hiddenCopyright © 2015. All Rights Reserved.