private void init() { mDownloadInfo = new DownloadInfo( mRequest.getTitle().toString(), mRequest.getUri(), mRequest.getFolder(), mRequest.getHeaders()); mDownloadTasks = new LinkedList<>(); }
// TODO private List<ThreadInfo> getMultiThreadInfos(long length) { // init threadInfo from db final List<ThreadInfo> threadInfos = mDBManager.getThreadInfos(mTag); if (threadInfos.isEmpty()) { final int threadNum = mConfig.getThreadNum(); for (int i = 0; i < threadNum; i++) { // calculate average final long average = length / threadNum; final long start = average * i; final long end; if (i == threadNum - 1) { end = length; } else { end = start + average - 1; } ThreadInfo threadInfo = new ThreadInfo(i, mTag, mRequest.getUri(), start, end, 0); threadInfos.add(threadInfo); } } return threadInfos; }
// TODO private ThreadInfo getSingleThreadInfo() { ThreadInfo threadInfo = new ThreadInfo(0, mTag, mRequest.getUri(), 0); return threadInfo; }
private void connect() { mConnectTask = new ConnectTaskImpl(mRequest.getUri(), mRequest.getHeaders(), this); mExecutor.execute(mConnectTask); }