FileDownloadCache

public class FileDownloadCache
extends Object

java.lang.Object
   ↳ com.android.tradefed.build.FileDownloadCache


A helper class that maintains a local filesystem LRU cache of downloaded files.

Summary

Public methods

void deleteCacheEntry(String remoteFilePath)

Allow deleting an entry from the cache.

File fetchRemoteFile(IFileDownloader downloader, String remotePath)

Returns a local file corresponding to the given remotePath

The local File will be copied from the cache if it exists, otherwise will be downloaded via the given IFileDownloader.

void setMaxCacheSize(long numBytes)

Set the maximum size of the local file cache.

Public methods

deleteCacheEntry

void deleteCacheEntry (String remoteFilePath)

Allow deleting an entry from the cache. In case the entry is invalid or corrupted.

Parameters
remoteFilePath String

fetchRemoteFile

File fetchRemoteFile (IFileDownloader downloader, 
                String remotePath)

Returns a local file corresponding to the given remotePath

The local File will be copied from the cache if it exists, otherwise will be downloaded via the given IFileDownloader.

Parameters
downloader IFileDownloader: the IFileDownloader
remotePath String: the remote file.
Returns
File a local File containing contents of remotePath
Throws
BuildRetrievalError if file could not be retrieved

setMaxCacheSize

void setMaxCacheSize (long numBytes)

Set the maximum size of the local file cache.

Cache will not be adjusted immediately if set to a smaller size than current, but will take effect on next file download.