samples/delegatingwriterfinal/src-api1.0/api/Writer.java
changeset 67 b029a28df444
parent 65 4db7ceebd2b3
child 68 a2de5429d581
     1.1 --- a/samples/delegatingwriterfinal/src-api1.0/api/Writer.java	Sat Jun 14 09:53:06 2008 +0200
     1.2 +++ b/samples/delegatingwriterfinal/src-api1.0/api/Writer.java	Sat Jun 14 09:53:07 2008 +0200
     1.3 @@ -1,6 +1,5 @@
     1.4  package api;
     1.5  
     1.6 -import java.io.BufferedWriter;
     1.7  import java.io.IOException;
     1.8  
     1.9  /** Fixing the problem caused by mixing subclassing and delegation in 
    1.10 @@ -63,24 +62,7 @@
    1.11      }
    1.12      
    1.13      public static Writer createBuffered(final Writer out) {
    1.14 -        class Delegate extends java.io.Writer {
    1.15 -            @Override
    1.16 -            public void write(char[] cbuf, int off, int len) throws IOException {
    1.17 -                out.write(cbuf, off, len);
    1.18 -            }
    1.19 -
    1.20 -            @Override
    1.21 -            public void flush() throws IOException {
    1.22 -                out.flush();
    1.23 -            }
    1.24 -
    1.25 -            @Override
    1.26 -            public void close() throws IOException {
    1.27 -                out.close();
    1.28 -            }
    1.29 -            
    1.30 -        }
    1.31 -        return create(new BufferedWriter(new Delegate()));
    1.32 +        return create(new SimpleBuffer(out));
    1.33      }
    1.34  
    1.35