public final class Downloader extends Object
| Modifier and Type | Method and Description |
|---|---|
protected static void |
checkForCommonExceptionTypes(IOException ex)
Analyzes the IOException, logs the appropriate information for debugging
purposes, and then throws a DownloadFailedException that wraps the IO
Exception for common IO Exceptions.
|
static void |
fetchFile(URL url,
File outputPath)
Retrieves a file from a given URL and saves it to the outputPath.
|
static void |
fetchFile(URL url,
File outputPath,
boolean useProxy)
Retrieves a file from a given URL and saves it to the outputPath.
|
static long |
getLastModified(URL url)
Makes an HTTP Head request to retrieve the last modified date of the
given URL.
|
public static void fetchFile(URL url, File outputPath) throws DownloadFailedException
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 filepublic static void fetchFile(URL url, File outputPath, boolean useProxy) throws DownloadFailedException
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 filepublic static long getLastModified(URL url) throws DownloadFailedException
url - the URL to retrieve the timestamp fromDownloadFailedException - is thrown if an exception occurs making
the HTTP requestprotected static void checkForCommonExceptionTypes(IOException ex) throws DownloadFailedException
ex - the original exceptionDownloadFailedException - a wrapper exception that contains the
original exception as the causeCopyright? 2012-15 Jeremy Long. All Rights Reserved.