Package ubic.gemma.core.util
Class SimpleDownloader
java.lang.Object
ubic.gemma.core.util.SimpleDownloader
A simple downloader for FTP and HTTP(s) URLs.
- Author:
- poirigui
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongDownload a file from a URL to a local destination.downloadAsync(URL url, Path dest, boolean force) Download a file from a URL to a local destination asynchronously.longdownloadInParallel(List<SimpleDownloader.URLAndDestination> urls2dest, boolean force) Download a file from a URL to a local destination asynchronously.voidsetCheckArchiveIntegrity(boolean checkArchiveIntegrity) Set whether to check the integrity of gzipped files after downloading.voidsetFileLockManager(FileLockManager fileLockManager) voidsetFtpClientFactory(FTPClientFactory ftpClientFactory) Set the factory for creating FTP clients.voidsetTaskExecutor(ExecutorService taskExecutor) Set the task executor for performing asynchronous downloads.
-
Constructor Details
-
SimpleDownloader
- Parameters:
retryPolicy- policy for retrying failed downloads, ornullto only attempt downloads once
-
-
Method Details
-
setFtpClientFactory
Set the factory for creating FTP clients. -
setTaskExecutor
Set the task executor for performing asynchronous downloads. -
setFileLockManager
-
setCheckArchiveIntegrity
public void setCheckArchiveIntegrity(boolean checkArchiveIntegrity) Set whether to check the integrity of gzipped files after downloading. -
downloadInParallel
public long downloadInParallel(List<SimpleDownloader.URLAndDestination> urls2dest, boolean force) throws IOException, InterruptedException Download a file from a URL to a local destination asynchronously.- Throws:
IOExceptionInterruptedException
-
downloadAsync
Download a file from a URL to a local destination asynchronously. -
download
Download a file from a URL to a local destination.- Parameters:
url- URL to downloaddest- destination for the downloadforce- download even if the file exists, has the same size and is up to date- Returns:
- the number of bytes that were downloaded
- Throws:
IOException
-