Package net.sourceforge.jnlp.cache
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 $
- Author:
- Jon A. Maxwell (JAM) - initial author
-
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.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.
-
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
Converts a URL into a local path string within the given directory. For example a url with subdirectory /tmp/ will result in a File that is located somewhere within /tmp/- Parameters:
location- the urlroot- the subdirectory- Returns:
- the file
-
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
-