public final class Downloader
extends java.lang.Object
| Constructor and Description |
|---|
Downloader(Settings settings)
Constructs a new Downloader object.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
fetchContent(java.net.URL url,
boolean useProxy)
Retrieves a file from a given URL and returns the contents.
|
java.lang.String |
fetchContent(java.net.URL url,
boolean useProxy,
java.lang.String userKey,
java.lang.String passwordKey)
Retrieves a file from a given URL and returns the contents.
|
void |
fetchFile(java.net.URL url,
java.io.File outputPath)
Retrieves a file from a given URL and saves it to the outputPath.
|
void |
fetchFile(java.net.URL url,
java.io.File outputPath,
boolean useProxy)
Retrieves a file from a given URL and saves it to the outputPath.
|
void |
fetchFile(java.net.URL url,
java.io.File outputPath,
boolean useProxy,
java.lang.String userKey,
java.lang.String passwordKey)
Retrieves a file from a given URL and saves it to the outputPath.
|
void |
fetchFile(java.net.URL url,
java.io.File outputPath,
java.lang.String userKey,
java.lang.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(java.net.URL url,
java.io.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(java.net.URL url,
java.io.File outputPath,
java.lang.String userKey,
java.lang.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(java.net.URL url,
java.io.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(java.net.URL url,
java.io.File outputPath,
boolean useProxy,
java.lang.String userKey,
java.lang.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 java.lang.String fetchContent(java.net.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 receivedpublic java.lang.String fetchContent(java.net.URL url,
boolean useProxy,
java.lang.String userKey,
java.lang.String passwordKey)
throws DownloadFailedException,
TooManyRequestsException,
ResourceNotFoundException
url - the URL of the file to downloaduseProxy - 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 receivedCopyright© 2012-21 Jeremy Long. All Rights Reserved.