public class MessageUtils extends Object
Internally, Jansi is used to render ANSI colors on any platform.
| 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(StringBuilder builder)
Create a message buffer with defined String builder. 
 | 
static int | 
getTerminalWidth()
Get the terminal width or -1 if the width cannot be determined. 
 | 
static boolean | 
isColorEnabled()
Is message color enabled: requires Jansi available (through Maven) and the color has not been disabled. 
 | 
static LoggerLevelRenderer | 
level()
Create a logger level renderer. 
 | 
static void | 
registerShutdownHook()
Register a shutdown hook with the JVM runtime, uninstalling Ansi support on
 JVM shutdown unless is has already been uninstalled at that time. 
 | 
static void | 
setColorEnabled(boolean flag)
Enables message color (if Jansi is available). 
 | 
static String | 
stripAnsiCodes(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 - to enable Jansipublic static boolean isColorEnabled()
public static MessageBuilder buffer()
public static MessageBuilder buffer(StringBuilder builder)
builder - initial content of the message bufferpublic static MessageBuilder buffer(int size)
size - size of the bufferpublic static LoggerLevelRenderer level()
public static String stripAnsiCodes(String msg)
msg - message eventually containing ANSI codespublic static void registerShutdownHook()
Delegates to doSystemUninstall() for the actual uninstall procedure
public static int getTerminalWidth()
Copyright © 2002–2021 The Apache Software Foundation. All rights reserved.