standardize all Downloaders on 8k block sizes
This is needed since this affects the onProgress broadcasts, and sending too many can peg the device's CPU. 1k was just too small. ANd 8k works fine for Bluetooth. fdroid/fdroidclient#1590
This commit is contained in:
parent
06b9abcee3
commit
66e909d606
@ -92,7 +92,7 @@ public class BluetoothDownloader extends Downloader {
|
||||
|
||||
@Override
|
||||
public void download() throws IOException, InterruptedException {
|
||||
downloadFromStream(1024, false);
|
||||
downloadFromStream(false);
|
||||
connection.closeQuietly();
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ public abstract class Downloader {
|
||||
return notFound;
|
||||
}
|
||||
|
||||
void downloadFromStream(int bufferSize, boolean resumable) throws IOException, InterruptedException {
|
||||
void downloadFromStream(boolean resumable) throws IOException, InterruptedException {
|
||||
Utils.debugLog(TAG, "Downloading from stream");
|
||||
InputStream input = null;
|
||||
OutputStream outputStream = new FileOutputStream(outputFile, resumable);
|
||||
@ -127,7 +127,7 @@ public abstract class Downloader {
|
||||
// we were interrupted before proceeding to the download.
|
||||
throwExceptionIfInterrupted();
|
||||
|
||||
copyInputToOutputStream(input, bufferSize, outputStream);
|
||||
copyInputToOutputStream(input, 8192, outputStream);
|
||||
} finally {
|
||||
Utils.closeQuietly(outputStream);
|
||||
Utils.closeQuietly(input);
|
||||
|
@ -175,7 +175,7 @@ public class HttpDownloader extends Downloader {
|
||||
}
|
||||
setupConnection(resumable);
|
||||
Utils.debugLog(TAG, "downloading " + urlString + " (is resumable: " + resumable + ")");
|
||||
downloadFromStream(8192, resumable);
|
||||
downloadFromStream(resumable);
|
||||
cacheTag = connection.getHeaderField(HEADER_FIELD_ETAG);
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,6 @@ public class LocalFileDownloader extends Downloader {
|
||||
} else if (fileLength > 0) {
|
||||
resumable = true;
|
||||
}
|
||||
downloadFromStream(8192, resumable);
|
||||
downloadFromStream(resumable);
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public class TreeUriDownloader extends Downloader {
|
||||
|
||||
@Override
|
||||
public void download() throws IOException, InterruptedException {
|
||||
downloadFromStream(8192, false);
|
||||
downloadFromStream(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user