Package software.amazon.smithy.cli
Class ColorFormatter.PrinterBuffer
java.lang.Object
software.amazon.smithy.cli.ColorFormatter.PrinterBuffer
- All Implemented Interfaces:
Appendable,AutoCloseable
- Enclosing interface:
- ColorFormatter
public static final class ColorFormatter.PrinterBuffer
extends Object
implements Appendable, AutoCloseable
A buffer associated with a
CliPrinter used to build up a string of colored text.
Use close() to write to the associated CliPrinter, or wrap the buffer in a
try-with-resources block.
-
Method Summary
Modifier and TypeMethodDescriptionappend(char c) append(CharSequence csq) append(CharSequence csq, int start, int end) voidclose()Writes styled text to the builder using the CliPrinter's color settings.println()Writes a system-dependent new line.Prints a line of styled text to the buffer.toString()
-
Method Details
-
toString
-
append
- Specified by:
appendin interfaceAppendable
-
append
- Specified by:
appendin interfaceAppendable
-
append
- Specified by:
appendin interfaceAppendable
-
print
Writes styled text to the builder using the CliPrinter's color settings.- Parameters:
text- Text to write.styles- Styles to apply to the text.- Returns:
- Returns self.
-
println
Prints a line of styled text to the buffer.- Parameters:
text- Text to print.styles- Styles to apply.- Returns:
- Returns self.
-
println
Writes a system-dependent new line.- Returns:
- Returns the buffer.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-