Class SimpleDownloader

java.lang.Object
ubic.gemma.core.util.SimpleDownloader

public class SimpleDownloader extends Object
A simple downloader for FTP and HTTP(s) URLs.
Author:
poirigui
  • Constructor Details

    • SimpleDownloader

      public SimpleDownloader(@Nullable SimpleRetryPolicy retryPolicy)
      Parameters:
      retryPolicy - policy for retrying failed downloads, or null to only attempt downloads once
  • Method Details

    • setFtpClientFactory

      public void setFtpClientFactory(@Nullable FTPClientFactory ftpClientFactory)
      Set the factory for creating FTP clients.
    • setTaskExecutor

      public void setTaskExecutor(@Nullable ExecutorService taskExecutor)
      Set the task executor for performing asynchronous downloads.
    • setFileLockManager

      public void setFileLockManager(@Nullable FileLockManager fileLockManager)
    • 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:
      IOException
      InterruptedException
    • downloadAsync

      public Future<Long> downloadAsync(URL url, Path dest, boolean force)
      Download a file from a URL to a local destination asynchronously.
    • download

      public long download(URL url, Path dest, boolean force) throws IOException
      Download a file from a URL to a local destination.
      Parameters:
      url - URL to download
      dest - destination for the download
      force - 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