Would it be possible that org.fusesource.jansi.Ansi implements the interface java.lang.Appendable? Since Ansi class full-fills the requirements from Appendable, this seems natural:
An object to which char sequences and values can be appended. The Appendable interface must be implemented by any class whose instances are intended to receive formatted output from a java.util.Formatter.
It would be also nice if the field private final StringBuilder builder; is defined as private final Appendable builder;. Then one can also write directly to other Appendable instances like PrintWriter or PrintStream and not just StringBuilder. Of course
@Override
public String toString() {
flushAttributes();
return builder.toString();
}
may return not the built string if builder is not an instance of StringBuilder.
Hello,
Would it be possible that
org.fusesource.jansi.Ansi
implements the interfacejava.lang.Appendable
? Since Ansi class full-fills the requirements from Appendable, this seems natural:It would be also nice if the field
private final StringBuilder builder;
is defined asprivate final Appendable builder;
. Then one can also write directly to other Appendable instances like PrintWriter or PrintStream and not just StringBuilder. Of coursemay return not the built string if builder is not an instance of StringBuilder.