Class WindowsTerminal
- java.lang.Object
-
- net.rubygrapefruit.platform.internal.AbstractTerminal
-
- net.rubygrapefruit.platform.internal.WindowsTerminal
-
- All Implemented Interfaces:
TerminalOutput
public class WindowsTerminal 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 WindowsTerminal(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
-
WindowsTerminal
public WindowsTerminal(Terminals.Output output)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
init
protected void init()
- Specified by:
initin classAbstractTerminal
-
supportsColor
public boolean supportsColor()
Description copied from interface:TerminalOutputReturns true if this terminal supports setting output colors.
-
supportsTextAttributes
public boolean supportsTextAttributes()
Description copied from interface:TerminalOutputReturns true if this terminal supports setting text attributes, such as bold.
-
supportsCursorMotion
public boolean supportsCursorMotion()
Description copied from interface:TerminalOutputReturns true if this terminal supports moving the cursor.
-
supportsCursorVisibility
public boolean supportsCursorVisibility()
Description copied from interface:TerminalOutputReturns true if this terminal supports hiding the cursor.
-
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.
-
getOutputStream
public java.io.OutputStream getOutputStream()
Description copied from interface:TerminalOutputReturns anOutputStreamthat writes to this terminal. The output stream is not buffered.
-
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().
-
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.
-
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.
-
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.
-
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.
-
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) throws NativeException
Description copied from interface:TerminalOutputMoves the cursor the given number of characters down.- Throws:
NativeException- On failure, or if this terminal does not support cursor motion.
-
cursorUp
public TerminalOutput cursorUp(int count) throws NativeException
Description copied from interface:TerminalOutputMoves the cursor the given number of characters up.- Throws:
NativeException- On failure, or if this terminal does not support cursor motion.
-
cursorLeft
public TerminalOutput cursorLeft(int count) throws NativeException
Description copied from interface:TerminalOutputMoves the cursor the given number of characters to the left.- Throws:
NativeException- On failure, or if this terminal does not support cursor motion.
-
cursorRight
public TerminalOutput cursorRight(int count) throws NativeException
Description copied from interface:TerminalOutputMoves the cursor the given number of characters to the right.- Throws:
NativeException- On failure, or if this terminal does not support cursor motion.
-
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.
-
-