Package net.rubygrapefruit.platform
Interface Terminal
-
- All Known Implementing Classes:
AbstractTerminal,AnsiTerminal,TerminfoTerminal,WindowsTerminal,WrapperTerminal
public interface TerminalAllows the terminal/console to be manipulated.On UNIX based platforms, this provides access to the terminal. On Windows platforms, this provides access to the console.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classTerminal.ColorBasic colors supported by a terminal.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Terminalbold()Switches the terminal to bold mode, if supported.TerminalclearToEndOfLine()Clears characters from the cursor position to the end of the current line.TerminalcursorDown(int count)Moves the cursor the given number of characters down.TerminalcursorLeft(int count)Moves the cursor the given number of characters to the left.TerminalcursorRight(int count)Moves the cursor the given number of characters to the right.TerminalcursorStartOfLine()Moves the cursor to the start of the current line.TerminalcursorUp(int count)Moves the cursor the given number of characters up.Terminalforeground(Terminal.Color color)Sets the terminal foreground color, if supported.TerminalSizegetTerminalSize()Returns the size of the terminal.Terminalnormal()Switches the terminal to normal mode.Terminalreset()Switches the terminal to normal mode and restores default colors.booleansupportsColor()Returns true if this terminal supports setting output colors.booleansupportsCursorMotion()Returns true if this terminal supports moving the cursor.booleansupportsTextAttributes()Returns true if this terminal supports setting text attributes, such as bold.
-
-
-
Method Detail
-
supportsTextAttributes
boolean supportsTextAttributes()
Returns true if this terminal supports setting text attributes, such as bold.
-
supportsColor
boolean supportsColor()
Returns true if this terminal supports setting output colors.
-
supportsCursorMotion
boolean supportsCursorMotion()
Returns true if this terminal supports moving the cursor.
-
getTerminalSize
TerminalSize getTerminalSize() throws NativeException
Returns the size of the terminal. Supported by all terminals.- Returns:
- The current terminal size. Never returns null.
- Throws:
NativeException- On failure.
-
foreground
Terminal foreground(Terminal.Color color) throws NativeException
Sets the terminal foreground color, if supported. Does nothing if this terminal does not support setting the foreground color.- Throws:
NativeException- On failure.
-
bold
Terminal bold() throws NativeException
Switches the terminal to bold mode, if supported. Does nothing if this terminal does not support bold mode.- Throws:
NativeException- On failure.
-
normal
Terminal normal() throws NativeException
Switches the terminal to normal mode. Supported by all terminals.- Throws:
NativeException- On failure.
-
reset
Terminal reset() throws NativeException
Switches the terminal to normal mode and restores default colors. Supported by all terminals.- Throws:
NativeException- On failure.
-
cursorLeft
Terminal cursorLeft(int count) throws NativeException
Moves the cursor the given number of characters to the left.- Throws:
NativeException- On failure, or if this terminal does not support cursor motion.
-
cursorRight
Terminal cursorRight(int count) throws NativeException
Moves the cursor the given number of characters to the right.- Throws:
NativeException- On failure, or if this terminal does not support cursor motion.
-
cursorUp
Terminal cursorUp(int count) throws NativeException
Moves the cursor the given number of characters up.- Throws:
NativeException- On failure, or if this terminal does not support cursor motion.
-
cursorDown
Terminal cursorDown(int count) throws NativeException
Moves the cursor the given number of characters down.- Throws:
NativeException- On failure, or if this terminal does not support cursor motion.
-
cursorStartOfLine
Terminal cursorStartOfLine() throws NativeException
Moves the cursor to the start of the current line.- Throws:
NativeException- On failure, or if this terminal does not support cursor motion.
-
clearToEndOfLine
Terminal clearToEndOfLine() throws NativeException
Clears characters from the cursor position to the end of the current line.- Throws:
NativeException- On failure, or if this terminal does not support clearing.
-
-