Package org.springframework.boot.ansi
Class AnsiOutput
- java.lang.Object
- org.springframework.boot.ansi.AnsiOutput
public abstract class AnsiOutput extends Object
Generates ANSI encoded output, automatically attempting to detect if the terminal supports ANSI.
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AnsiOutput.Enabled
Possible values to pass tosetEnabled(org.springframework.boot.ansi.AnsiOutput.Enabled)
.
Constructor Summary
Constructors Constructor Description AnsiOutput()
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
encode(AnsiElement element)
Encode a singleAnsiElement
if output is enabled.static void
setConsoleAvailable(Boolean consoleAvailable)
Sets if the System.console() is known to be available.static void
setEnabled(AnsiOutput.Enabled enabled)
Sets if ANSI output is enabled.static String
toString(Object... elements)
Create a new ANSI string from the specified elements.
Constructor Detail
AnsiOutput
public AnsiOutput()
Method Detail
setEnabled
public static void setEnabled(AnsiOutput.Enabled enabled)
Sets if ANSI output is enabled.- Parameters:
enabled
- if ANSI is enabled, disabled or detected
setConsoleAvailable
public static void setConsoleAvailable(Boolean consoleAvailable)
Sets if the System.console() is known to be available.- Parameters:
consoleAvailable
- if the console is known to be available ornull
to use standard detection logic.
encode
public static String encode(AnsiElement element)
Encode a singleAnsiElement
if output is enabled.- Parameters:
element
- the element to encode- Returns:
- the encoded element or an empty string
toString
public static String toString(Object... elements)
Create a new ANSI string from the specified elements. AnyAnsiElement
s will be encoded as required.- Parameters:
elements
- the elements to encode- Returns:
- a string of the encoded elements