FileDocCategorySizeDatePackage
CacheManager.javaAPI DocAndroid 5.1 API11163Thu Mar 12 22:22:10 GMT 2015android.webkit

CacheManager

public final class CacheManager extends Object
Manages the HTTP cache used by an application's {@link WebView} instances.
deprecated
Access to the HTTP cache will be removed in a future release.
hide
Since {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}

Fields Summary
Constructors Summary
Methods Summary
public static booleancacheDisabled()
Gets whether the HTTP cache is disabled.

return
true if the HTTP cache is disabled
deprecated
This method no longer has any effect and always returns false.

        return false;
    
public static booleanendCacheTransaction()
Ends the innermost cache transaction and returns whether this was the only running transaction.

return
true if this was the only running transaction
deprecated
This method no longer has any effect and always returns false.

        return false;
    
public static android.webkit.CacheManager$CacheResultgetCacheFile(java.lang.String url, java.util.Map headers)
Gets the cache entry for the specified URL, or null if none is found. If a non-null value is provided for the HTTP headers map, and the cache entry needs validation, appropriate headers will be added to the map. The input stream of the CacheEntry object should be closed by the caller when access to the underlying file is no longer required.

param
url the URL for which a cache entry is requested
param
headers a map from HTTP header name to value, to be populated for the returned cache entry
return
the cache entry for the specified URL
deprecated
This method no longer has any effect and always returns null.

        return null;
    
public static java.io.FilegetCacheFileBaseDir()
Gets the base directory in which the files used to store the contents of cache entries are placed. See {@link CacheManager.CacheResult#getLocalPath CacheManager.CacheResult.getLocalPath()}.

return
the base directory of the cache
deprecated
This method no longer has any effect and always returns null.

        return null;
    
public static voidsaveCacheFile(java.lang.String url, android.webkit.CacheManager$CacheResult cacheResult)
Adds a cache entry to the HTTP cache for the specicifed URL. Also closes the cache entry's output stream.

param
url the URL for which the cache entry should be added
param
cacheResult the cache entry to add
deprecated
Access to the HTTP cache will be removed in a future release.

        saveCacheFile(url, 0, cacheResult);
    
static voidsaveCacheFile(java.lang.String url, long postIdentifier, android.webkit.CacheManager$CacheResult cacheRet)

        try {
            cacheRet.outStream.close();
        } catch (IOException e) {
            return;
        }

        // This method is exposed in the public API but the API provides no
        // way to obtain a new CacheResult object with a non-null output
        // stream ...
        // - CacheResult objects returned by getCacheFile() have a null
        //   output stream.
        // - new CacheResult objects have a null output stream and no
        //   setter is provided.
        // Since this method throws a null pointer exception in this case,
        // it is effectively useless from the point of view of the public
        // API.
        //
        // With the Chromium HTTP stack we continue to throw the same
        // exception for 'backwards compatibility' with the Android HTTP
        // stack.
        //
        // This method is not used from within this package, and for public API
        // use, we should already have thrown an exception above.
        assert false;
    
public static booleanstartCacheTransaction()
Starts a cache transaction. Returns true if this is the only running transaction. Otherwise, this transaction is nested inside currently running transactions and false is returned.

return
true if this is the only running transaction
deprecated
This method no longer has any effect and always returns false.

        return false;