类 AnsiOutput

java.lang.Object
cn.taketoday.core.ansi.AnsiOutput

public abstract class AnsiOutput extends Object
Generates ANSI encoded output, automatically attempting to detect if the terminal supports ANSI.
从以下版本开始:
4.0
作者:
Phillip Webb
  • 字段详细资料

  • 构造器详细资料

    • AnsiOutput

      public AnsiOutput()
  • 方法详细资料

    • setEnabled

      public static void setEnabled(AnsiOutput.Enabled enabled)
      Sets if ANSI output is enabled.
      参数:
      enabled - if ANSI is enabled, disabled or detected
    • getEnabled

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

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

      public static String encode(AnsiElement element)
      Encode a single AnsiElement if output is enabled.
      参数:
      element - the element to encode
      返回:
      the encoded element or an empty string
    • toString

      public static String toString(Object... elements)
      Create a new ANSI string from the specified elements. Any AnsiElements will be encoded as required.
      参数:
      elements - the elements to encode
      返回:
      a string of the encoded elements
    • buildEnabled

      private static void buildEnabled(StringBuilder sb, Object[] elements)
    • buildDisabled

      private static void buildDisabled(StringBuilder sb, Object[] elements)
    • isEnabled

      private static boolean isEnabled()
    • detectIfAnsiCapable

      private static boolean detectIfAnsiCapable()