public abstract class ANSITerminal extends StreamBasedTerminal
Terminal.Color, Terminal.ResizeListener, Terminal.SGR
writerMutex
Constructor and Description |
---|
ANSITerminal(InputStream terminalInput,
OutputStream terminalOutput,
Charset terminalCharset) |
Modifier and Type | Method and Description |
---|---|
void |
applyBackgroundColor(int index)
Changes the background color for all the following characters put to the
terminal.
|
void |
applyBackgroundColor(int r,
int g,
int b)
Changes the background color for all the following characters put to the
terminal.
|
void |
applyBackgroundColor(Terminal.Color color)
Changes the background color for all the following characters put to the
terminal.
|
void |
applyForegroundColor(int index)
Changes the foreground color for all the following characters put to the
terminal.
|
void |
applyForegroundColor(int r,
int g,
int b)
Changes the foreground color for all the following characters put to the
terminal.
|
void |
applyForegroundColor(Terminal.Color color)
Changes the foreground color for all the following characters put to the
terminal.
|
void |
applySGR(Terminal.SGR... options)
Activates an
SGR code for all the following characters put to the
terminal. |
void |
clearScreen()
Removes all the characters, colors and graphics from the screep and leaves
you with a big empty space.
|
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. |
void |
moveCursor(int x,
int y)
Moves the text cursor to a new location
|
TerminalSize |
queryTerminalSize()
Deprecated.
|
protected void |
reportPosition()
Synchronize with writerMutex externally!!!
|
protected void |
restoreCursorPosition()
Synchronize with writerMutex externally!!!
|
protected void |
saveCursorPosition()
Synchronize with writerMutex externally!!!
|
abstract 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 |
setCursorVisible(boolean visible)
Hides or shows the text cursor
|
abstract void |
setEcho(boolean echoOn)
Enables or disables keyboard echo, meaning the immediate output of the
characters you type on your keyboard.
|
flush, putCharacter, translateCharacter, writeToTerminal
addInputProfile, readInput, waitForTerminalSizeReport
addResizeListener, getLastKnownSize, onResized, removeResizeListener
public ANSITerminal(InputStream terminalInput, OutputStream terminalOutput, Charset terminalCharset)
@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.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.public void applyBackgroundColor(Terminal.Color color)
Terminal
color
- Color to use for the backgroundpublic void applyBackgroundColor(int r, int g, int b)
Terminal
r
- Red intensity, from 0 to 255g
- Green intensity, from 0 to 255b
- Blue intensity, from 0 to 255public void applyBackgroundColor(int index)
Terminal
For more details on this, please see this commit message to Konsole.
index
- Index of the color to use, from the XTerm 256 color extensionpublic void applyForegroundColor(Terminal.Color color)
Terminal
color
- Color to use for foregroundpublic void applyForegroundColor(int r, int g, int b)
Terminal
r
- Red intensity, from 0 to 255g
- Green intensity, from 0 to 255b
- Blue intensity, from 0 to 255public void applyForegroundColor(int index)
Terminal
For more details on this, please see this commit message to Konsole.
index
- Color index from the XTerm 256 color spacepublic void applySGR(Terminal.SGR... options)
Terminal
SGR
code for all the following characters put to the
terminal.options
- List of SGR codesTerminal.SGR
public void clearScreen()
Terminal
moveCursor
next.public void enterPrivateMode()
Terminal
public void exitPrivateMode()
Terminal
public abstract void setEcho(boolean echoOn)
echoOn
- true if keyboard input will immediately echo, false if it's hiddenLanternaException
public abstract void setCBreak(boolean cbreakOn)
cbreakOn
- LanternaException
public void moveCursor(int x, int y)
Terminal
x
- The 0-indexed column to place the cursor aty
- The 0-indexed row to place the cursor atpublic void setCursorVisible(boolean visible)
Terminal
visible
- Hides the text cursor if false
and shows it if true
protected void reportPosition()
protected void restoreCursorPosition()
protected void saveCursorPosition()
Copyright © 2015. All Rights Reserved.