class MatchingOutputStream extends OutputStream {

  @Override
  public void write(int b) throws IOException {
    int expected = expectedBytesStream.read();
    if (expected == -1) {
      throw new MismatchException("EOF reached in expectedBytesStream");
    }
    if (expected != b) {
      throw new MismatchException("Data does not match");
    }
  }

  public  MatchingOutputStream(InputStream expectedBytesStream, int matchBufferSize);

}