package de.siegmar.fastcsv;

import java.io.Writer;
import java.util.Arrays;

import org.openjdk.jmh.infra.Blackhole;

/**
 * Writer implementation that sends all data to a black hole.
 */
public class NullWriter extends Writer {

    private static final int BUFFER_SIZE = 8192;

    private final Blackhole bh;
    private final char[] buf = new char[BUFFER_SIZE];
    private int pos;

    NullWriter(final Blackhole bh) {
        this.bh = bh;
    }

    @Override
    public void write(final char[] cbuf, final int off, final int len) {
        if (len + pos > buf.length) {
            flush();
        }
        System.arraycopy(cbuf, off, buf, pos, len);
        pos += len;
    }

    @Override
    public void flush() {
        bh.consume(Arrays.copyOf(buf, pos));
        pos = 0;
    }

    @Override
    public void close() {
        flush();
    }

}

@@ -440,32 +440,185 @@
 bh = bh;%0A    %7D%0A%0A
+    @Override%0A    public void write(final int c) %7B%0A        if (pos == buf.length) %7B%0A            flush();%0A        %7D%0A        buf%5Bpos++%5D = (char) c;%0A    %7D%0A%0A
     @Override%0A  
@@ -828,32 +828,262 @@
  += len;%0A    %7D%0A%0A
+    @Override%0A    public void write(final String str, final int off, final int len) %7B%0A        if (len + pos %3E buf.length) %7B%0A            flush();%0A        %7D%0A        str.getChars(off, off + len, buf, pos);%0A        pos += len;%0A    %7D%0A%0A
     @Override%0A  

add write methods to allow better comparison