org.springframework.boot.ansi

Class AnsiOutput

  • java.lang.Object
    • org.springframework.boot.ansi.AnsiOutput


  • public abstract class AnsiOutput
    extends java.lang.Object
    Generates ANSI encoded output, automatically attempting to detect if the terminal supports ANSI.
    Since:
    1.0.0
    • 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
      • getEnabled

        public static AnsiOutput.Enabled getEnabled()
        Returns if ANSI output is enabled
        Returns:
        if ANSI enabled, disabled or detected
      • setConsoleAvailable

        public static void setConsoleAvailable(java.lang.Boolean consoleAvailable)
        Sets if the System.console() is known to be available.
        Parameters:
        consoleAvailable - if the console is known to be available or null to use standard detection logic.
      • encode

        public static java.lang.String encode(AnsiElement element)
        Encode a single AnsiElement if output is enabled.
        Parameters:
        element - the element to encode
        Returns:
        the encoded element or an empty string
      • toString

        public static java.lang.String toString(java.lang.Object... elements)
        Create a new ANSI string from the specified elements. Any AnsiElements will be encoded as required.
        Parameters:
        elements - the elements to encode
        Returns:
        a string of the encoded elements