All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.schoolwow.download.domain.pool.DownloadPool Maven / Gradle / Ivy

The newest version!
package cn.schoolwow.download.domain.pool;

import cn.schoolwow.download.domain.progress.DownloadProgress;
import cn.schoolwow.download.domain.task.DownloadContext;
import cn.schoolwow.download.domain.task.DownloadTask;

import java.nio.file.Path;
import java.util.List;
import java.util.function.Consumer;

/**下载线程池接口*/
public interface DownloadPool {
    /**
     * 获取下载配置
     * */
    DownloadPoolConfig getDownloadPoolConfig();

    /**
     * 获取下载进度列表
     * */
    List getProgressList();

    /**
     * 打印下载进度表
     * */
    void printDownloadProgress();

    /**
     * 下载任务
     * @param downloadTasks 下载任务
     * @return 下载任务令牌(可用于中断任务等)
     * */
    DownloadContext[] download(DownloadTask... downloadTasks);

    /**
     * 下载任务
     * @param downloadFinished 指定下载任务列表完成后执行
     * @param downloadTasks 下载任务
     * */
    void download(Consumer downloadFinished, DownloadTask... downloadTasks);

    /**
     * 暂停下载
     * @param id 下载任务id
     * */
    void pauseDownload(long id);

    /**
     * 恢复下载
     * @param id 下载任务id
     * */
    void resumeDownload(long id);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy