|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfiftyone.mobile.detection.AutoUpdate
public class AutoUpdate
| Constructor Summary | |
|---|---|
AutoUpdate()
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AutoUpdate()
| Method Detail |
|---|
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 String joinString(String seperator,
String[] strings)
private static URL fullUrl(String[] licenseKeys)
throws MalformedURLException
MalformedURLException
public static boolean update(String licenseKey,
String dataFilePath)
throws AutoUpdateException
licenseKey - the licence key to submit to the server
AutoUpdateException
public static boolean update(String[] licenseKeys,
String dataFilePath)
throws AutoUpdateException
licenseKeys - the licence keys to submit to the server
AutoUpdateExceptionprivate static String[] getValidKeys(String[] licenseKeys)
private static byte[] download(String[] licenseKeys,
long lastModified)
throws AutoUpdateException
licenseKeys - an array of keys to fetch a new data file with.
AutoUpdateException
private static byte[] decompressData(byte[] content)
throws IOException,
DataFormatException
IOException
DataFormatException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||