1 package perf; 2 3 import java.io.*; 4 5 public class NopWriter extends Writer 6 { 7 protected int size = 0; 8 NopWriter()9 public NopWriter() { } 10 11 @Override write(int b)12 public void write(int b) throws IOException { ++size; } 13 14 @Override write(char[] b)15 public void write(char[] b) throws IOException { size += b.length; } 16 17 @Override write(char[] b, int offset, int len)18 public void write(char[] b, int offset, int len) throws IOException { size += len; } 19 size()20 public int size() { return size; } 21 22 @Override close()23 public void close() throws IOException { } 24 25 @Override flush()26 public void flush() throws IOException { } 27 } 28