public class AutoUpdate extends Object
| Constructor and Description |
|---|
AutoUpdate() |
| Modifier and Type | Method and Description |
|---|---|
private static byte[] |
decompressData(byte[] content) |
private static byte[] |
download(String[] licenseKeys,
long lastModified)
Downloads and validates data, returning a byte array or null if download
or validation was unsuccessful.
|
private static URL |
fullUrl(String[] licenseKeys)
Constructs the URL needed to download Premium data.
|
private static String |
getMd5Hash(byte[] value)
Calculates the MD5 hash of the given data array.
|
private static Dataset |
getNewDataset(String[] licenseKeys,
String dataFilePath)
Downloads the latest Premium data and saves to disk if the data has been
downloaded correctly and is newer than data currently in that position
(if any) in that path.
|
private static String[] |
getValidKeys(String[] licenseKeys) |
private static String |
joinString(String seperator,
String[] strings) |
static boolean |
update(String[] licenseKeys,
String dataFilePath)
Uses the given license key to perform a device data update, writing the
data to the file system and filling providers from this factory instance
with it.
|
static boolean |
update(String licenseKey,
String dataFilePath)
Uses the given license key to perform a device data update, writing the
data to the file system and filling providers from this factory instance
with it.
|
private static boolean |
validateMD5(HttpURLConnection client,
byte[] data)
Verifies that the data has been downloaded correctly by comparing an MD5
hash off the downloaded data with one taken before the data was sent,
which is stored in a response header.
|
private static Dataset getNewDataset(String[] licenseKeys, String dataFilePath) throws AutoUpdateException
AutoUpdateExceptionprivate static String getMd5Hash(byte[] value)
value - Data to calculate the hash with.private static boolean validateMD5(HttpURLConnection client, byte[] data)
client - The Premium data download connection.data - the data that has been downloaded.private static URL fullUrl(String[] licenseKeys) throws MalformedURLException
MalformedURLExceptionpublic static boolean update(String licenseKey, String dataFilePath) throws AutoUpdateException
licenseKey - the licence key to submit to the serverAutoUpdateExceptionpublic static boolean update(String[] licenseKeys, String dataFilePath) throws AutoUpdateException
licenseKeys - the licence keys to submit to the serverAutoUpdateExceptionprivate static byte[] download(String[] licenseKeys, long lastModified) throws AutoUpdateException
licenseKeys - an array of keys to fetch a new data file with.AutoUpdateExceptionprivate static byte[] decompressData(byte[] content)
throws IOException,
DataFormatException
IOExceptionDataFormatException