MultiThreadDownloader icon indicating copy to clipboard operation
MultiThreadDownloader copied to clipboard

无法重复下载

Open zdd opened this issue 9 years ago • 3 comments

下载完成后,再次点击下载,一直显示 xxx is downloading... 进度条也不更新。

zdd avatar Feb 15 '16 09:02 zdd

找到原因了。

    private void dlInit(HttpURLConnection conn, int code) throws Exception {
        readResponseHeaders(conn);
        DLDBManager.getInstance(context).updateTaskInfo(info);
        if (!DLUtil.createFile(info.dirPath, info.fileName))
            throw new DLException("Can not create file");
        info.file = new File(info.dirPath, info.fileName);
        // 如果文件存在则不再下载,这里应该通知用户,现在是毫无反应,这导致无法重复下载同一个文件。
        if (info.file.exists() && info.file.length() == info.totalBytes) {
            Log.d(TAG, "The file which we want to download was already here.");
            return;
        }

zdd avatar Feb 17 '16 03:02 zdd

或者在dlStart里面加一个参数,是否覆盖已有文件。

zdd avatar Feb 17 '16 03:02 zdd

他这里是判断文件是否存在,你把文件删除了,他也不会再下载了?你的会这样吗

ghost avatar Jun 25 '16 09:06 ghost