public class HttpDownloadHelper extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
HttpDownloadHelper.Checksummer |
static interface |
HttpDownloadHelper.DownloadProgress
Interface implemented for reporting
progress of downloading.
|
static class |
HttpDownloadHelper.NullProgress
do nothing with progress info
|
static class |
HttpDownloadHelper.VerboseProgress
verbose progress system prints to some output stream
|
Modifier and Type | Field and Description |
---|---|
static HttpDownloadHelper.Checksummer |
MD5_CHECKSUM
Checksummer for MD5
|
static HttpDownloadHelper.Checksummer |
SHA1_CHECKSUM
Checksummer for SHA1
|
Constructor and Description |
---|
HttpDownloadHelper() |
Modifier and Type | Method and Description |
---|---|
boolean |
download(URL source,
Path dest,
HttpDownloadHelper.DownloadProgress progress,
TimeValue timeout) |
boolean |
downloadAndVerifyChecksum(URL checksumURL,
Path originalFile,
Path checksumFile,
HttpDownloadHelper.DownloadProgress progress,
TimeValue timeout,
HttpDownloadHelper.Checksummer hashFunc)
Download the given checksum URL to the destination and check the checksum
|
public static HttpDownloadHelper.Checksummer SHA1_CHECKSUM
public static HttpDownloadHelper.Checksummer MD5_CHECKSUM
public boolean download(URL source, Path dest, @Nullable HttpDownloadHelper.DownloadProgress progress, TimeValue timeout) throws Exception
Exception
public boolean downloadAndVerifyChecksum(URL checksumURL, Path originalFile, Path checksumFile, @Nullable HttpDownloadHelper.DownloadProgress progress, TimeValue timeout, HttpDownloadHelper.Checksummer hashFunc) throws Exception
checksumURL
- URL for the checksum fileoriginalFile
- original file to calculate checksum ofchecksumFile
- destination to download the checksum file tohashFunc
- class used to calculate the checksum of the fileException
- if the checksum failed to matchCopyright © 2009–2016. All rights reserved.