/** * delete a download file * * @param url file url * @param deleteDownloadedFileInPath whether delete file in path * @param onDeleteDownloadFileListener OnDeleteDownloadFileListener impl */ public static void delete(String url, boolean deleteDownloadedFileInPath, OnDeleteDownloadFileListener onDeleteDownloadFileListener) { getFileDownloadManager().delete(url, deleteDownloadedFileInPath, onDeleteDownloadFileListener); }
/** * start/continue multi downloads * <br/> * if the caller cares for the download status, please register an listener before by using * <br/> * {@link #registerDownloadStatusListener(OnFileDownloadStatusListener)} * <br> * {@link #registerDownloadStatusListener(OnFileDownloadStatusListener, DownloadStatusConfiguration)} * * @param urls file urls */ public static void start(List<String> urls) { getFileDownloadManager().start(urls); }
/** * get download save dir * * @return download save dir */ public static String getDownloadDir() { return getFileDownloadManager().getDownloadDir(); }
/** * register an OnFileDownloadStatusListener * * @param onFileDownloadStatusListener OnFileDownloadStatusListener impl, or use {@link * OnRetryableFileDownloadStatusListener}, which can retry download when * download failed once when use {@link FileDownloadConfiguration * .Builder#configRetryDownloadTimes(int)} to config the retry times */ public static void registerDownloadStatusListener(OnFileDownloadStatusListener onFileDownloadStatusListener) { getFileDownloadManager().registerDownloadStatusListener(onFileDownloadStatusListener); }
/** * detect a url file * * @param url file url * @param onDetectUrlFileListener OnDetectUrlFileListener impl * @deprecated this method can not detect the url file which bigger than 2G, use {@link #detect(String, * OnDetectBigUrlFileListener)}instead */ @Deprecated public static void detect(String url, OnDetectUrlFileListener onDetectUrlFileListener) { getFileDownloadManager().detect(url, onDetectUrlFileListener); }
/** * pause a download * * @param url file url */ public static void pause(String url) { getFileDownloadManager().pause(url); }
/** * pause all downloads */ public static void pauseAll() { getFileDownloadManager().pauseAll(); }
/** * move a download file * * @param url file url * @param newDirPath new dir path * @param onMoveDownloadFileListener OnMoveDownloadFileListener impl */ public static void move(String url, String newDirPath, OnMoveDownloadFileListener onMoveDownloadFileListener) { getFileDownloadManager().move(url, newDirPath, onMoveDownloadFileListener); }
/** * get DownloadFile by temp file path * * @param tempPath temp file path * @return DownloadFile */ public static DownloadFileInfo getDownloadFileByTempPath(String tempPath) { return getFileDownloadManager().getDownloadFileByTempPath(tempPath); }
/** * unregister an OnFileDownloadStatusListener * * @param onFileDownloadStatusListener registered OnFileDownloadStatusListener or * OnRetryableFileDownloadStatusListener impl */ public static void unregisterDownloadStatusListener(OnFileDownloadStatusListener onFileDownloadStatusListener) { getFileDownloadManager().unregisterDownloadStatusListener(onFileDownloadStatusListener); }
/** * register an OnDownloadFileChangeListener * * @param onDownloadFileChangeListener OnDownloadFileChangeListener impl */ public static void registerDownloadFileChangeListener(OnDownloadFileChangeListener onDownloadFileChangeListener) { getFileDownloadManager().registerDownloadFileChangeListener(onDownloadFileChangeListener, null); }
/** * unregister an OnDownloadFileChangeListener * * @param onDownloadFileChangeListener registered OnDownloadFileChangeListener impl */ public static void unregisterDownloadFileChangeListener(OnDownloadFileChangeListener onDownloadFileChangeListener) { getFileDownloadManager().unregisterDownloadFileChangeListener(onDownloadFileChangeListener); }
/** * move multi download files * * @param urls file urls * @param newDirPath new dir path * @param onMoveDownloadFilesListener OnMoveDownloadFilesListener impl * @return a control for the operation */ public static Control move(List<String> urls, String newDirPath, OnMoveDownloadFilesListener onMoveDownloadFilesListener) { return getFileDownloadManager().move(urls, newDirPath, onMoveDownloadFilesListener); }
/** * delete multi download files * * @param urls file urls * @param deleteDownloadedFile whether delete file in path * @param onDeleteDownloadFilesListener OnDeleteDownloadFilesListener impl * @return a control for the operation */ public static Control delete(List<String> urls, boolean deleteDownloadedFile, OnDeleteDownloadFilesListener onDeleteDownloadFilesListener) { return getFileDownloadManager().delete(urls, deleteDownloadedFile, onDeleteDownloadFilesListener); }
/** * get DownloadFile by file url * * @param url file url * @return DownloadFile */ public static DownloadFileInfo getDownloadFile(String url) { return getFileDownloadManager().getDownloadFile(url); }
/** * get all DownloadFiles * * @return all DownloadFiles */ public static List<DownloadFileInfo> getDownloadFiles() { return getFileDownloadManager().getDownloadFiles(); }
/** * detect a big url file, which means can detect the url file bigger than 2G * * @param url file url * @param onDetectBigUrlFileListener OnDetectBigUrlFileListener impl * @since 0.3.0 */ public static void detect(String url, OnDetectBigUrlFileListener onDetectBigUrlFileListener) { getFileDownloadManager().detect(url, onDetectBigUrlFileListener); }
/** * pause multi downloads * * @param urls file urls */ public static void pause(List<String> urls) { getFileDownloadManager().pause(urls); }
/** * whether the file-downloader is initialized * * @return true means the file-downloader has been initialized */ public static boolean isInit() { if (FileDownloadManager.getFileDownloadConfiguration() == null) { return false; } return getFileDownloadManager().isInit(); }
/** * release resources */ public static void release() { if (FileDownloadManager.getFileDownloadConfiguration() != null && isInit()) { getFileDownloadManager().release(); } }