public ProgressOutputStream(OutputStream sink, long bytesSoFar, long expectedSize) {
super(sink);
this.bytesSoFar = new AtomicLong(bytesSoFar);
this.progress = new SimpleDoubleProperty();
this.throttler = new ThrottledRunLater(() -> progress.set(this.bytesSoFar.get() / (double) expectedSize));
}