String tempFileName = hashURL(url.toExternalForm()) + ".temp";
File destinationTempFile = new File(cacheDir, tempFileName);
File destinationCacheData = new File(cacheDir, tempFileName + ".cache.properties");
//update from URL if necessary
final URLFileUpdaterBuilder urlFileUpdaterBuilder = new URLFileUpdaterBuilder()
.setUrl(url)
.setAcceptHeader("*/*")
.setTimeout(DEFAULT_TIMEOUT);
if (USE_CACHE) {
urlFileUpdaterBuilder
.setCacheMetadataFile(destinationCacheData)
.setCachedContent(destinationTempFile)
.setUseCaching(true);
}
final URLFileUpdater updater = urlFileUpdaterBuilder.createURLFileUpdater();
try {
if (null != interaction) {
//allow mock
updater.setInteraction(interaction);
}