Interface DependencyDownloader

All Known Implementing Classes:
MavenDependencyDownloader

public interface DependencyDownloader
Interface for downloading dependencies and their checksums from repositories.
  • Field Details

    • USER_AGENT

      static final String USER_AGENT
      A default User-Agent string for HTTP requests to identify the Amber library.
  • Method Details

    • defaultDownloaders

      static Map<RepositoryType,DependencyDownloader> defaultDownloaders()
      Provides a map of default downloaders for each supported repository type.
      Returns:
      A map associating each RepositoryType with its corresponding DependencyDownloader.
    • downloadJar

      DownloadResult downloadJar(Dependency dependency, Repository repository, Path filePath) throws IOException
      Downloads the jar file for the specified dependency from the given repository and saves it to the specified file path.
      Parameters:
      dependency - the dependency to download
      repository - the repository to download from
      filePath - the path to save the downloaded jar file
      Returns:
      a DownloadResult indicating the success or failure of the download
      Throws:
      IOException - if an I/O error occurs during the download
    • downloadChecksum

      StringDownloadResult downloadChecksum(Dependency dependency, Repository repository, ChecksumType checksumType) throws IOException
      Downloads the checksum for the specified dependency from the given repository.
      Parameters:
      dependency - the dependency to download the checksum for
      repository - the repository to download from
      checksumType - the type of checksum to download (e.g., MD5, SHA-1, SHA-256)
      Returns:
      a StringDownloadResult containing the checksum string if successful, or an error message if failed
      Throws:
      IOException - if an I/O error occurs during the download