Class CacheUtil
java.lang.Object
net.sourceforge.jnlp.cache.CacheUtil
Provides static methods to interact with the cache, download
indicator, and other utility methods.
- Version:
- $Revision: 1.17 $
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FiledownloadAndGetCacheFile(URL location, VersionString version) Caches a resource and returns a URL for it in the cache; blocks until resource is cached.private static DownloadServiceListenergetDownloadServiceListener(JNLPClassLoader jnlpClassLoader, String title, URL[] undownloaded, DownloadIndicator indicator) private static StringgetProgressClass(JNLPClassLoader jnlpClassLoader) static Stringstatic booleanisCacheable(URL source) Returns whether the resource can be cached as a local file; if not, then URLConnection.openStream can be used to obtain the contents.static booleanisNonCacheable(URL source) Returns whether the resource can be cached as a local file; if not, then URLConnection.openStream can be used to obtain the contents.static voidlogCacheIds(String filter) static FileConverts a URL into a local path string within the given directory.static voidwaitForResources(JNLPClassLoader jnlpClassLoader, ResourceTracker tracker, URL[] resources, String title) Waits until the resources are downloaded, while showing a progress indicator.
-
Field Details
-
LOG
-
NON_CACHEABLE_PROTOCOLS
-
-
Constructor Details
-
CacheUtil
public CacheUtil()
-
-
Method Details
-
downloadAndGetCacheFile
Caches a resource and returns a URL for it in the cache; blocks until resource is cached. If the resource location is not cacheable (points to a local file, etc) then the original URL is returned.- Parameters:
location- location of the resourceversion- the version, ornull- Returns:
- either the location in the cache or the original location
-
logCacheIds
-
isNonCacheable
Returns whether the resource can be cached as a local file; if not, then URLConnection.openStream can be used to obtain the contents.- Parameters:
source- the url of resource- Returns:
- whether this resource can be cached
-
isCacheable
Returns whether the resource can be cached as a local file; if not, then URLConnection.openStream can be used to obtain the contents.- Parameters:
source- the url of resource- Returns:
- whether this resource can be cached
-
urlToPath
-
hex
- Throws:
NoSuchAlgorithmException
-
waitForResources
public static void waitForResources(JNLPClassLoader jnlpClassLoader, ResourceTracker tracker, URL[] resources, String title) Waits until the resources are downloaded, while showing a progress indicator.- Parameters:
jnlpClassLoader- the classloadertracker- the resource trackerresources- the resources to wait fortitle- name of the download
-
getDownloadServiceListener
private static DownloadServiceListener getDownloadServiceListener(JNLPClassLoader jnlpClassLoader, String title, URL[] undownloaded, DownloadIndicator indicator) -
getProgressClass
-