BAEL-4856 Rename ProgressCallable to ProgressCallback
This commit is contained in:
parent
34c9e82eee
commit
081abb8dd7
|
@ -9,11 +9,11 @@ public class BinaryFileWriter implements AutoCloseable {
|
||||||
|
|
||||||
private static final int CHUNK_SIZE = 1024;
|
private static final int CHUNK_SIZE = 1024;
|
||||||
private final OutputStream outputStream;
|
private final OutputStream outputStream;
|
||||||
private final ProgressCallable progressCallable;
|
private final ProgressCallback progressCallback;
|
||||||
|
|
||||||
public BinaryFileWriter(OutputStream outputStream, ProgressCallable progressCallable) {
|
public BinaryFileWriter(OutputStream outputStream, ProgressCallback progressCallback) {
|
||||||
this.outputStream = outputStream;
|
this.outputStream = outputStream;
|
||||||
this.progressCallable = progressCallable;
|
this.progressCallback = progressCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long write(InputStream inputStream, double length) throws IOException {
|
public long write(InputStream inputStream, double length) throws IOException {
|
||||||
|
@ -24,7 +24,7 @@ public class BinaryFileWriter implements AutoCloseable {
|
||||||
while ((readBytes = input.read(dataBuffer)) != -1) {
|
while ((readBytes = input.read(dataBuffer)) != -1) {
|
||||||
totalBytes += readBytes;
|
totalBytes += readBytes;
|
||||||
outputStream.write(dataBuffer, 0, readBytes);
|
outputStream.write(dataBuffer, 0, readBytes);
|
||||||
progressCallable.onProgress(totalBytes / length * 100.0);
|
progressCallback.onProgress(totalBytes / length * 100.0);
|
||||||
}
|
}
|
||||||
return totalBytes;
|
return totalBytes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.baeldung.okhttp.download;
|
package com.baeldung.okhttp.download;
|
||||||
|
|
||||||
public interface ProgressCallable {
|
public interface ProgressCallback {
|
||||||
|
|
||||||
void onProgress(double progress);
|
void onProgress(double progress);
|
||||||
|
|
Loading…
Reference in New Issue