class BufferedElementCountingOutputStream extends OutputStream {

  @Override
  public void flush() throws IOException {
    if (finished) {
      return;
    }
    outputBuffer();
    os.flush();
  }

  public  BufferedElementCountingOutputStream(OutputStream os);
  public  BufferedElementCountingOutputStream(OutputStream os, long terminatorValue);
    BufferedElementCountingOutputStream(OutputStream os, int bufferSize, long terminatorValue);

}