public final class Downloader extends Object
| Constructor and Description |
|---|
Downloader(Settings settings)
Constructs a new Downloader object.
|
| Modifier and Type | Method and Description |
|---|---|
String |
fetchContent(URL url,
boolean useProxy)
Retrieves a file from a given URL and returns the contents.
|
void |
fetchFile(URL url,
File outputPath)
Retrieves a file from a given URL and saves it to the outputPath.
|
void |
fetchFile(URL url,
File outputPath,
boolean useProxy)
Retrieves a file from a given URL and saves it to the outputPath.
|
void |
fetchFile(URL url,
File outputPath,
boolean useProxy,
String userKey,
String passwordKey)
Retrieves a file from a given URL and saves it to the outputPath.
|
void |
fetchFile(URL url,
File outputPath,
String userKey,
String passwordKey)
Retrieves a file from a given URL and saves it to the outputPath.
|
public Downloader(Settings settings)
settings - the configured settingspublic void fetchFile(URL url, File outputPath) throws DownloadFailedException, TooManyRequestsException, ResourceNotFoundException
url - the URL of the file to downloadoutputPath - the path to the save the file toDownloadFailedException - is thrown
if there is an error downloading the fileTooManyRequestsException - thrown when a 429 is receivedResourceNotFoundException - thrown when a 404 is receivedpublic void fetchFile(URL url, File outputPath, String userKey, String passwordKey) throws DownloadFailedException, TooManyRequestsException, ResourceNotFoundException
url - the URL of the file to downloadoutputPath - the path to the save the file touserKey - the settings key for the username to be usedpasswordKey - the settings key for the password to be usedDownloadFailedException - is thrown
if there is an error downloading the fileTooManyRequestsException - thrown when a 429 is receivedResourceNotFoundException - thrown when a 404 is receivedpublic void fetchFile(URL url, File outputPath, boolean useProxy) throws DownloadFailedException, TooManyRequestsException, ResourceNotFoundException
url - the URL of the file to downloadoutputPath - the path to the save the file touseProxy - whether to use the configured proxy when downloading
filesDownloadFailedException - is thrown
if there is an error downloading the fileTooManyRequestsException - thrown when a 429 is receivedResourceNotFoundException - thrown when a 404 is receivedpublic void fetchFile(URL url, File outputPath, boolean useProxy, String userKey, String passwordKey) throws DownloadFailedException, TooManyRequestsException, ResourceNotFoundException
url - the URL of the file to downloadoutputPath - the path to the save the file touseProxy - whether to use the configured proxy when downloading
filesuserKey - the settings key for the username to be usedpasswordKey - the settings key for the password to be usedDownloadFailedException - is thrown
if there is an error downloading the fileTooManyRequestsException - thrown when a 429 is receivedResourceNotFoundException - thrown when a 404 is receivedpublic String fetchContent(URL url, boolean useProxy) throws DownloadFailedException, TooManyRequestsException, ResourceNotFoundException
url - the URL of the file to downloaduseProxy - whether to use the configured proxy when downloading
filesDownloadFailedException - is thrown if there is an error
downloading the fileTooManyRequestsException - thrown when a 429 is receivedResourceNotFoundException - thrown when a 404 is receivedCopyright © 2012–2020 OWASP. All rights reserved.