Class AttributedStringBuilder

java.lang.Object
org.jline.utils.AttributedCharSequence
org.jline.utils.AttributedStringBuilder
All Implemented Interfaces:
Appendable, CharSequence

public class AttributedStringBuilder extends AttributedCharSequence implements Appendable
A mutable builder for creating styled text strings with ANSI attributes.

The AttributedStringBuilder class provides a mutable implementation of AttributedCharSequence for constructing styled text strings. It allows for dynamic building of attributed strings by appending characters, strings, or other attributed strings with various styles.

This class is similar to StringBuilder but with added support for ANSI style attributes. It provides methods for appending text with different styles, manipulating the content, and converting the result to an immutable AttributedString when building is complete.

Key features include:

  • Append operations with different styles
  • Tab expansion with configurable tab stops
  • Style manipulation (foreground/background colors, bold, underline, etc.)
  • Regular expression based styling
  • Alternative character set support

This class is commonly used for building complex styled output for terminal applications, such as syntax highlighting, interactive prompts, and formatted displays.

See Also: