public Builder toBuilder(String anotherUrl, Uri anotherUri) { final Builder builder = new Builder(anotherUrl, anotherUri) .setPriority(priority) .setReadBufferSize(readBufferSize) .setFlushBufferSize(flushBufferSize) .setSyncBufferSize(syncBufferSize) .setSyncBufferIntervalMillis(syncBufferIntervalMills) .setAutoCallbackToUIThread(autoCallbackToUIThread) .setMinIntervalMillisCallbackProcess(minIntervalMillisCallbackProcess) .setHeaderMapFields(headerMapFields) .setPassIfAlreadyCompleted(passIfAlreadyCompleted); // check whether the filename is special set from method. if (Util.isUriFileScheme(anotherUri) // only if another uri is file-scheme && !new File(anotherUri.getPath()).isFile() // another uri is not file already && Util.isUriFileScheme(uri) // only if uri is file-scheme // only if filename is provided and not provided through uri && filenameHolder.get() != null && !new File(uri.getPath()).getName().equals(filenameHolder.get()) ) { builder.setFilename(filenameHolder.get()); } return builder; }
assertThat(queueSet.getSyncBufferSize()).isEqualTo(syncBufferSize); builder.bind(taskBuilder); verify(taskBuilder).setSyncBufferSize(eq(syncBufferSize));
public DownloadTask bind(@NonNull DownloadTask.Builder taskBuilder) { if (set.headerMapFields != null) taskBuilder.setHeaderMapFields(set.headerMapFields); if (set.readBufferSize != null) taskBuilder.setReadBufferSize(set.readBufferSize); if (set.flushBufferSize != null) taskBuilder.setFlushBufferSize(set.flushBufferSize); if (set.syncBufferSize != null) taskBuilder.setSyncBufferSize(set.syncBufferSize); if (set.wifiRequired != null) taskBuilder.setWifiRequired(set.wifiRequired); if (set.syncBufferIntervalMillis != null) { taskBuilder.setSyncBufferIntervalMillis(set.syncBufferIntervalMillis); } if (set.autoCallbackToUIThread != null) { taskBuilder.setAutoCallbackToUIThread(set.autoCallbackToUIThread); } if (set.minIntervalMillisCallbackProcess != null) { taskBuilder .setMinIntervalMillisCallbackProcess(set.minIntervalMillisCallbackProcess); } if (set.passIfAlreadyCompleted != null) { taskBuilder.setPassIfAlreadyCompleted(set.passIfAlreadyCompleted); } final DownloadTask task = taskBuilder.build(); if (set.tag != null) task.setTag(set.tag); boundTaskList.add(task); return task; }
.setReadBufferSize(1) .setFlushBufferSize(2) .setSyncBufferSize(3) .setSyncBufferIntervalMillis(4) .setMinIntervalMillisCallbackProcess(5)