public class CacheUtil
extends java.lang.Object
| Constructor and Description | 
|---|
| CacheUtil() | 
| Modifier and Type | Method and Description | 
|---|---|
| static void | cleanCache()This will remove all old cache items. | 
| static boolean | clearCache()Clears the cache by deleting all the Netx cache files
 Note: Because of how our caching system works, deleting jars of another javaws
 process is using them can be quite disasterous. | 
| static java.io.File | getCachedResourceFile(java.net.URL location,
                     Version version,
                     UpdatePolicy policy)This is returning File object of cached resource originally from URL | 
| static java.net.URL | getCachedResourceURL(java.net.URL location,
                    Version version,
                    UpdatePolicy policy)Caches a resource and returns a URL for it in the cache;
 blocks until resource is cached. | 
| static java.io.File | getCacheFile(java.net.URL source,
            Version version)Returns the file for the locally cached contents of the
 source. | 
| static java.lang.String | getCacheParentDirectory(java.lang.String filePath)Returns the parent directory of the cached resource. | 
| static java.io.OutputStream | getOutputStream(java.net.URL source,
               Version version)Returns a buffered output stream open for writing to the
 cache file. | 
| static java.security.Permission | getReadPermission(java.net.URL location,
                 Version version)Returns the Permission object necessary to access the
 resource, or  nullif no permission is needed. | 
| static boolean | isCacheable(java.net.URL source,
           Version version)Returns whether the resource can be cached as a local file;
 if not, then URLConnection.openStream can be used to obtain
 the contents. | 
| static boolean | isCached(java.net.URL source,
        Version version)Returns true if the cache has a local copy of the contents of
 the URL matching the specified version string. | 
| static boolean | isCurrent(java.net.URL source,
         Version version,
         long lastModifed)Returns whether there is a version of the URL contents in the
 cache and it is up to date. | 
| static java.io.File | makeNewCacheFile(java.net.URL source,
                Version version)This will create a new entry for the cache item. | 
| static void | streamCopy(java.io.InputStream is,
          java.io.OutputStream os)Copies from an input stream to an output stream. | 
| static java.io.File | urlToPath(java.net.URL location,
         java.lang.String subdir)Converts a URL into a local path string within the given directory. | 
| static void | waitForResources(ApplicationInstance app,
                ResourceTracker tracker,
                java.net.URL[] resources,
                java.lang.String title)Waits until the resources are downloaded, while showing a
 progress indicator. | 
public static java.net.URL getCachedResourceURL(java.net.URL location,
                                Version version,
                                UpdatePolicy policy)
location - location of the resourceversion - the version, or nullpolicy - how to handle updatepublic static java.io.File getCachedResourceFile(java.net.URL location,
                                 Version version,
                                 UpdatePolicy policy)
location - original location of blobversion - version of resourcepolicy - update policy of resourcepublic static java.security.Permission getReadPermission(java.net.URL location,
                                         Version version)
null if no permission is needed.location - location of the resourceversion - the version, or nullpublic static boolean clearCache()
okToClearCache()public static boolean isCurrent(java.net.URL source,
                Version version,
                long lastModifed)
source - the source URLversion - the versions to check forlastModifed - time in milis since epoch of last modficationjava.lang.IllegalArgumentException - if the source is not cacheablepublic static boolean isCached(java.net.URL source,
               Version version)
source - the source URLversion - the versions to check forjava.lang.IllegalArgumentException - if the source is not cacheablepublic static boolean isCacheable(java.net.URL source,
                  Version version)
source - the url of resourceversion - version of resourcepublic static java.io.File getCacheFile(java.net.URL source,
                        Version version)
source - the source URLversion - the version id of the local filenull if no versions cachedjava.lang.IllegalArgumentException - if the source is not cacheablepublic static java.lang.String getCacheParentDirectory(java.lang.String filePath)
filePath - The path of the cached resource directory.public static java.io.File makeNewCacheFile(java.net.URL source,
                            Version version)
source - the source URLversion - the version id of the local filepublic static java.io.OutputStream getOutputStream(java.net.URL source,
                                   Version version)
                                            throws java.io.IOException
source - the remote locationversion - the file version to write tojava.io.IOException - if IO breakspublic static void streamCopy(java.io.InputStream is,
              java.io.OutputStream os)
                       throws java.io.IOException
is - stream to read fromos - stream to write tojava.io.IOException - if copy failspublic static java.io.File urlToPath(java.net.URL location,
                     java.lang.String subdir)
location - the urlsubdir - the subdirectorypublic static void waitForResources(ApplicationInstance app, ResourceTracker tracker, java.net.URL[] resources, java.lang.String title)
app - application instance with context for this resourcetracker - the resource trackerresources - the resources to wait fortitle - name of the downloadpublic static void cleanCache()