public class MessageUtils
extends java.lang.Object
Internally, Jansi is used to render ANSI colors on any platform.
Modifier and Type | Field and Description |
---|---|
private static boolean |
JANSI |
Constructor and Description |
---|
MessageUtils() |
Modifier and Type | Method and Description |
---|---|
static MessageBuilder |
buffer()
Create a default message buffer.
|
static MessageBuilder |
buffer(int size)
Create a message buffer with an internal buffer of defined size.
|
static MessageBuilder |
buffer(java.lang.StringBuilder builder)
Create a message buffer with defined String builder.
|
static boolean |
isColorEnabled()
Is message color enabled: requires JAnsi available (through Maven) and the color has not been disabled.
|
static void |
setColorEnabled(boolean flag)
Enables message color (if JAnsi is available).
|
static java.lang.String |
stripAnsiCodes(java.lang.String msg)
Remove any ANSI code from a message (colors or other escape sequences).
|
static void |
systemInstall()
Install color support.
|
static void |
systemUninstall()
Undo a previous
systemInstall() . |
public static void systemInstall()
public static void systemUninstall()
systemInstall()
. If systemInstall()
was called
multiple times, systemUninstall()
must be called call the same number of times before
it is actually uninstalled.public static void setColorEnabled(boolean flag)
flag
- public static boolean isColorEnabled()
public static MessageBuilder buffer()
public static MessageBuilder buffer(java.lang.StringBuilder builder)
public static MessageBuilder buffer(int size)
public static java.lang.String stripAnsiCodes(java.lang.String msg)
msg
- message eventually containing ANSI codes