Package javadl

Class Downloader

java.lang.Object
javadl.Downloader

public class Downloader extends Object
Main class where you must create downloads and manage them. Create it with the custom DownloadHandler to start receiving Download events.
  • Constructor Details

    • Downloader

      public Downloader()
  • Method Details

    • downloadFileToLocation

      public Download downloadFileToLocation(String urlStr, File file)
      This method downloads the file asynchronously, executing it in a ThreadPool.
      Parameters:
      urlStr - Download URL
      file - Where should the file be saved
      Returns:
      The Download model contains relevant information and methods to assist in handling the process.
    • downloadFileToLocation

      public Download downloadFileToLocation(String urlStr, Path path)
      This method downloads the file asynchronously, executing it in a ThreadPool.
      Parameters:
      urlStr - Download URL
      path - Where should the file be saved
      Returns:
      The Download model contains relevant information and methods to assist in handling the process.
    • downloadFileToLocation

      public Download downloadFileToLocation(String urlStr, String pathToDownload)
      This method downloads the file asynchronously, executing it in a ThreadPool.
      Parameters:
      urlStr - Download URL
      pathToDownload - Where should the file be saved
      Returns:
      The Download model contains relevant information and methods to assist in handling the process.
    • waitForDownloadFileToLocation

      public Download waitForDownloadFileToLocation(String urlStr, File file)
      This method downloads a file in the same thread in which it was called, locking it during the process.
      It can be useful if you want to stop the execution while the Download is not carried out.
      Parameters:
      urlStr - Download URL
      file - Where should the file be saved
      Returns:
      The Download model contains relevant information and methods to assist in handling the process.
    • waitForDownloadFileToLocation

      public Download waitForDownloadFileToLocation(String urlStr, Path file)
      This method downloads a file in the same thread in which it was called, locking it during the process.
      It can be useful if you want to stop the execution while the Download is not carried out.
      Parameters:
      urlStr - Download URL
      file - Where should the file be saved
      Returns:
      The Download model contains relevant information and methods to assist in handling the process.
    • waitForDownloadFileToLocation

      public Download waitForDownloadFileToLocation(String urlStr, String file)
      This method downloads a file in the same thread in which it was called, locking it during the process.
      It can be useful if you want to stop the execution while the Download is not carried out.
      Parameters:
      urlStr - Download URL
      file - Where should the file be saved
      Returns:
      The Download model contains relevant information and methods to assist in handling the process.
    • downloadObject

      public Download downloadObject(String urlStr)