3 import java.io.IOException;
5 /** Fixing the problem caused by mixing subclassing and delegation in
6 * the <code>java.io.BufferedWriter</code>
8 * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
10 public final class Writer {
11 private final Impl impl;
13 private Writer(Impl impl) {
16 public final void write(int c) throws IOException {
17 impl.write(new CharSeq(c));
20 public final void write(char cbuf[]) throws IOException {
21 impl.write(new CharSeq(cbuf, 0, cbuf.length));
23 public final void write(char cbuf[], int off, int len) throws IOException {
24 impl.write(new CharSeq(cbuf, off, len));
26 public final void write(String str) throws IOException {
29 public final void write(String str, int off, int len) throws IOException {
30 impl.write(str.subSequence(off, off + len));
35 public static interface Impl {
36 public void write(CharSequence seq) throws IOException;