下载缓存区变大

pull/330/head
AriaLyy 8 years ago
parent 41154d47fb
commit 8f452c6ea5
  1. 4
      Aria/src/main/java/com/arialyy/aria/core/task/SingleThreadTask.java
  2. 3
      app/src/main/java/com/arialyy/simple/single_task/SingleTaskActivity.java

@ -32,6 +32,8 @@ import java.util.Properties;
*/
final class SingleThreadTask implements Runnable {
private static final String TAG = "SingleThreadTask";
// TODO: 2017/2/22 不能使用1024 否则最大速度不能超过3m
private static final int BUF_SIZE = 8196;
private DownloadUtil.ConfigEntity mConfigEntity;
private String mConfigFPath;
private long mChildCurrentLocation = 0;
@ -78,7 +80,7 @@ final class SingleThreadTask implements Runnable {
RandomAccessFile file = new RandomAccessFile(mConfigEntity.TEMP_FILE, "rwd");
//设置每条线程写入文件的位置
file.seek(mConfigEntity.START_LOCATION);
byte[] buffer = new byte[1024];
byte[] buffer = new byte[BUF_SIZE];
int len;
//当前子线程的下载位置
mChildCurrentLocation = mConfigEntity.START_LOCATION;

@ -52,7 +52,8 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
private static final String DOWNLOAD_URL =
//"http://kotlinlang.org/docs/kotlin-docs.pdf";
"https://atom-installer.github.com/v1.13.0/AtomSetup.exe?s=1484074138&ext=.exe";
//"https://atom-installer.github.com/v1.13.0/AtomSetup.exe?s=1484074138&ext=.exe";
"http://static.gaoshouyou.com/d/21/e8/61218d78d0e8b79df68dbc18dd484c97.apk";
@Bind(R.id.progressBar) HorizontalProgressBarWithNumber mPb;
@Bind(R.id.start) Button mStart;
@Bind(R.id.stop) Button mStop;

Loading…
Cancel
Save