class NotifyingOutputStream extends OutputStream {

  @Override
  public void write(int singleByte) throws IOException {
    underlyingOutputStream.write(singleByte);
    countAndCallListener(1);
  }

  public  NotifyingOutputStream(
      OutputStream underlyingOutputStream, Consumer<Long> byteCountListener);

}