As the purpose of buffer is to "buffer", let's modify our example to delegate to appendable methods directly only if the appendable is too big
3 import java.io.IOException;
7 * @author Jaroslav Tulach
9 final class SimpleBuffer implements Writer.ImplSeq {
10 private final Writer out;
11 private final StringBuffer sb = new StringBuffer();
13 public SimpleBuffer(Writer out) {
17 public void close() throws IOException {
22 public void flush() throws IOException {
23 if (sb.length() > 0) {
24 out.write(sb.toString());
30 public void write(CharSequence seq) throws IOException {
31 if (seq.length() < 1024) {