filesLastModified = new HashMap<String, Long>();
// store file sizes and mark which files not to download
fileSizes = new int[urlList.length];
URLConnection urlconnection;
File cacheFile = new File(dir, "cache");
// if cache file exists, load it
if (cacheFile.exists()) {
filesLastModified = readCacheFile(cacheFile);
}
// calculate total size of jars to download
for (int i = 0; i < urlList.length; i++) {
urlconnection = urlList[i].openConnection();
urlconnection.setDefaultUseCaches(false);
if (urlconnection instanceof HttpURLConnection) {
((HttpURLConnection) urlconnection).setRequestMethod("HEAD");
}
fileSizes[i] = urlconnection.getContentLength();
long lastModified = urlconnection.getLastModified();
String fileName = getFileName(urlList[i]);
if (cacheEnabled && lastModified != 0 &&
filesLastModified.containsKey(fileName)) {