Class TerminfoTerminal
- java.lang.Object
-
- net.rubygrapefruit.platform.internal.AbstractTerminal
-
- net.rubygrapefruit.platform.internal.TerminfoTerminal
-
- All Implemented Interfaces:
TerminalOutput
public class TerminfoTerminal extends AbstractTerminal
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.rubygrapefruit.platform.terminal.TerminalOutput
TerminalOutput.Color
-
-
Field Summary
-
Fields inherited from class net.rubygrapefruit.platform.internal.AbstractTerminal
NEW_LINE
-
-
Constructor Summary
Constructors Constructor Description TerminfoTerminal(Terminals.Output output)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TerminalOutputbold()Switches the terminal to bold text mode, if supported.TerminalOutputbright()Switches the terminal to high intensity, if supported.TerminalOutputclearToEndOfLine()Clears characters from the cursor position to the end of the current line.TerminalOutputcursorDown(int count)Moves the cursor the given number of characters down.TerminalOutputcursorLeft(int count)Moves the cursor the given number of characters to the left.TerminalOutputcursorRight(int count)Moves the cursor the given number of characters to the right.TerminalOutputcursorStartOfLine()Moves the cursor to the start of the current line.TerminalOutputcursorUp(int count)Moves the cursor the given number of characters up.TerminalOutputdefaultForeground()Sets the terminal foreground color to the default, if supported.TerminalOutputdim()Switches the terminal to dim intensity, if supported.TerminalOutputforeground(TerminalOutput.Color color)Sets the terminal foreground color, if supported.java.io.OutputStreamgetOutputStream()Returns anOutputStreamthat writes to this terminal.TerminalSizegetTerminalSize()Returns the size of the terminal.TerminalOutputhideCursor()Hides the cursor.protected voidinit()TerminalOutputnormal()Switches the terminal to normal text mode.TerminalOutputreset()Resets this terminal.TerminalOutputshowCursor()Shows the cursor, if hidden.booleansupportsColor()Returns true if this terminal supports setting output colors.booleansupportsCursorMotion()Returns true if this terminal supports moving the cursor.booleansupportsCursorVisibility()Returns true if this terminal supports hiding the cursor.booleansupportsTextAttributes()Returns true if this terminal supports setting text attributes, such as bold.java.lang.StringtoString()-
Methods inherited from class net.rubygrapefruit.platform.internal.AbstractTerminal
newline, streamForOutput, write, write, write
-
-
-
-
Constructor Detail
-
TerminfoTerminal
public TerminfoTerminal(Terminals.Output output)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
init
protected void init()
- Specified by:
initin classAbstractTerminal
-
getTerminalSize
public TerminalSize getTerminalSize()
Description copied from interface:TerminalOutputReturns the size of the terminal. Supported by all terminals.- Returns:
- The current terminal size. Never returns null.
-
supportsColor
public boolean supportsColor()
Description copied from interface:TerminalOutputReturns true if this terminal supports setting output colors.
-
supportsCursorMotion
public boolean supportsCursorMotion()
Description copied from interface:TerminalOutputReturns true if this terminal supports moving the cursor.
-
supportsTextAttributes
public boolean supportsTextAttributes()
Description copied from interface:TerminalOutputReturns true if this terminal supports setting text attributes, such as bold.
-
supportsCursorVisibility
public boolean supportsCursorVisibility()
Description copied from interface:TerminalOutputReturns true if this terminal supports hiding the cursor.
-
getOutputStream
public java.io.OutputStream getOutputStream()
Description copied from interface:TerminalOutputReturns anOutputStreamthat writes to this terminal. The output stream is not buffered.
-
foreground
public TerminalOutput foreground(TerminalOutput.Color color)
Description copied from interface:TerminalOutputSets the terminal foreground color, if supported. Does nothing if this terminal does not support setting the foreground color.
-
bold
public TerminalOutput bold()
Description copied from interface:TerminalOutputSwitches the terminal to bold text mode, if supported. Does nothing if this terminal does not support bold mode.Often the same as
TerminalOutput.bright().
-
dim
public TerminalOutput dim() throws NativeException
Description copied from interface:TerminalOutputSwitches the terminal to dim intensity, if supported. Does nothing if this terminal does not support dim mode.- Throws:
NativeException- On failure.
-
bright
public TerminalOutput bright() throws NativeException
Description copied from interface:TerminalOutputSwitches the terminal to high intensity, if supported. Does nothing if this terminal does not support bright mode.- Throws:
NativeException- On failure.
-
normal
public TerminalOutput normal()
Description copied from interface:TerminalOutputSwitches the terminal to normal text mode. Switches off bold text mode and sets normal intensity. Supported by all terminals.
-
defaultForeground
public TerminalOutput defaultForeground() throws NativeException
Description copied from interface:TerminalOutputSets the terminal foreground color to the default, if supported. Does nothing if this terminal does not support setting the foreground color.- Throws:
NativeException- On failure.
-
reset
public TerminalOutput reset()
Description copied from interface:TerminalOutputResets this terminal. Switches to normal text mode, restores default foreground color and shows the cursor. Supported by all terminals.
-
hideCursor
public TerminalOutput hideCursor() throws NativeException
Description copied from interface:TerminalOutputHides the cursor. Does nothing if this terminal does not support hiding the cursor.- Throws:
NativeException- On failure.
-
showCursor
public TerminalOutput showCursor() throws NativeException
Description copied from interface:TerminalOutputShows the cursor, if hidden. Supported by all terminals.- Throws:
NativeException- On failure.
-
cursorDown
public TerminalOutput cursorDown(int count)
Description copied from interface:TerminalOutputMoves the cursor the given number of characters down.
-
cursorUp
public TerminalOutput cursorUp(int count)
Description copied from interface:TerminalOutputMoves the cursor the given number of characters up.
-
cursorLeft
public TerminalOutput cursorLeft(int count)
Description copied from interface:TerminalOutputMoves the cursor the given number of characters to the left.
-
cursorRight
public TerminalOutput cursorRight(int count)
Description copied from interface:TerminalOutputMoves the cursor the given number of characters to the right.
-
cursorStartOfLine
public TerminalOutput cursorStartOfLine() throws NativeException
Description copied from interface:TerminalOutputMoves the cursor to the start of the current line.- Throws:
NativeException- On failure, or if this terminal does not support cursor motion.
-
clearToEndOfLine
public TerminalOutput clearToEndOfLine() throws NativeException
Description copied from interface:TerminalOutputClears characters from the cursor position to the end of the current line.- Throws:
NativeException- On failure, or if this terminal does not support clearing.
-
-