Class AnsiOutput
java.lang.Object
org.springframework.boot.ansi.AnsiOutput
Generates ANSI encoded output, automatically attempting to detect if the terminal
supports ANSI.
- Since:
- 1.0.0
- Author:
- Phillip Webb, Yong-Hyun Kim
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Possible values to pass tosetEnabled(org.springframework.boot.ansi.AnsiOutput.Enabled)
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
encode
(AnsiElement element) Encode a singleAnsiElement
if output is enabled.static AnsiOutput.Enabled
Returns if ANSI output is enabledstatic void
setConsoleAvailable
(@Nullable 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
Create a new ANSI string from the specified elements.
-
Constructor Details
-
AnsiOutput
public AnsiOutput()
-
-
Method Details
-
setEnabled
Sets if ANSI output is enabled.- Parameters:
enabled
- if ANSI is enabled, disabled or detected
-
getEnabled
Returns if ANSI output is enabled- Returns:
- if ANSI enabled, disabled or detected
-
setConsoleAvailable
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
Encode a singleAnsiElement
if output is enabled.- Parameters:
element
- the element to encode- Returns:
- the encoded element or an empty string
-
toString
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
-