Don't add count=-1 to bytesRead when finished

This commit is contained in:
Daniel Martí 2015-05-30 00:51:35 +02:00
parent 29403c1d84
commit 38ab8ac353

View File

@ -173,12 +173,12 @@ public abstract class Downloader {
int count = input.read(buffer);
throwExceptionIfInterrupted();
bytesRead += count;
sendProgress(bytesRead, totalBytes);
if (count == -1) {
Log.d(TAG, "Finished downloading from stream");
break;
}
bytesRead += count;
sendProgress(bytesRead, totalBytes);
outputStream.write(buffer, 0, count);
}
outputStream.flush();