Class LicenseDownloader
java.lang.Object
org.codehaus.mojo.license.download.LicenseDownloader
- All Implemented Interfaces:
AutoCloseable
Utilities for downloading remote license files.
- Since:
- 1.0
- Author:
- pgier
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A result of a license download operation. -
Constructor Summary
ConstructorsConstructorDescriptionLicenseDownloader
(org.apache.maven.settings.Proxy proxy, int connectTimeout, int socketTimeout, int connectionRequestTimeout, Map<String, SpdxLicenseList.Attachments.ContentSanitizer> contentSanitizers, Charset charset) -
Method Summary
Modifier and TypeMethodDescriptionstatic String
calculateStringChecksum
(String contentString) void
close()
downloadLicense
(String licenseUrlString, FileNameEntry fileNameEntry) Downloads a license file from the givenlicenseUrlString
stores it locally and returns the local path where the license file was stored.
-
Constructor Details
-
LicenseDownloader
public LicenseDownloader(org.apache.maven.settings.Proxy proxy, int connectTimeout, int socketTimeout, int connectionRequestTimeout, Map<String, SpdxLicenseList.Attachments.ContentSanitizer> contentSanitizers, Charset charset)
-
-
Method Details
-
downloadLicense
public LicenseDownloader.LicenseDownloadResult downloadLicense(String licenseUrlString, FileNameEntry fileNameEntry) throws IOException, URISyntaxException, org.apache.maven.plugin.MojoFailureException Downloads a license file from the givenlicenseUrlString
stores it locally and returns the local path where the license file was stored. Note that theoutputFile
name can be further modified by this method, esp. the file extension can be adjusted based on the mime type of the HTTP response.- Parameters:
licenseUrlString
- the URLfileNameEntry
- a hint where to store the license file- Returns:
- the path to the file where the downloaded license file was stored
- Throws:
IOException
URISyntaxException
org.apache.maven.plugin.MojoFailureException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
-
calculateStringChecksum
-