FileDownloadCacheWrapper
public class FileDownloadCacheWrapper
extends Object
implements IFileDownloader
java.lang.Object |
↳ | com.android.tradefed.build.FileDownloadCacheWrapper |
一個包裝器類,在實現IFileDownloader
接口時提供FileDownloadCache
功能。
對於要從調用者中提取緩存使用情況的情況很有用。
概要
公開方法 |
---|
void | downloadFile (String remoteFilePath, File destFile) downloadFile(String) 替代形式,它允許調用者指定應將遠程內容放入的目標文件。 |
File | downloadFile (String remoteFilePath) 將遠程文件下載到本地磁盤上的臨時文件。 |
void | downloadZippedFiles (File destDir, String remoteFilePath, includeFilters, excludeFilters) downloadZippedFiles (File destDir, String remoteFilePath, includeFilters, excludeFilters) downloadZippedFiles (File destDir, String remoteFilePath, includeFilters, excludeFilters) 將與給定過濾器匹配的文件下載到遠程zip文件中。 |
boolean | isFresh (File localFile, String remoteFilePath) 檢查本地文件的新鮮度。 |
公共建設者
FileDownloadCacheWrapper
public FileDownloadCacheWrapper (File cacheDir,
IFileDownloader delegateDownloader)
參量 |
---|
cacheDir | File |
delegateDownloader | IFileDownloader |
公開方法
下載文件
public void downloadFile (String remoteFilePath,
File destFile)
downloadFile(String)
替代形式,允許調用者指定應將遠程內容放入的目標文件。
參量 |
---|
remoteFilePath | String :要下載的文件的遠程路徑,相對於特定於實現的根目錄。 |
destFile | File :用於放置下載內容的文件。不應該存在。 |
下載文件
public File downloadFile (String remoteFilePath)
將遠程文件下載到本地磁盤上的臨時文件。
參量 |
---|
remoteFilePath | String :相對於實現特定的根目錄,要下載的文件的遠程路徑。 |
下載壓縮文件
public void downloadZippedFiles (File destDir,
String remoteFilePath,
includeFilters,
excludeFilters)
將與給定過濾器匹配的文件下載到遠程zip文件中。
遠程zip文件中的文件僅下載到其路徑,該路徑與任何包含過濾器匹配,但與排除過濾器匹配。
參量 |
---|
destDir | File :用於放置下載內容的文件。 |
remoteFilePath | String :相對於實現特定的根目錄,要下載的文件的遠程路徑。 |
includeFilters | :用於下載匹配文件的過濾器列表。 |
excludeFilters | :跳過下載匹配文件的過濾器列表。 |
isFresh
public boolean isFresh (File localFile,
String remoteFilePath)
檢查本地文件的新鮮度。如果本地文件與遠程文件相同,那麼它是最新的。如果不是,則本地文件是陳舊的。這主要用於緩存。默認實現將始終返回true,因此,如果文件是不可變的,則不再需要檢查新鮮度。
參量 |
---|
localFile | File :本地文件。 |
remoteFilePath | String :遠程文件路徑。 |
退貨 |
---|
boolean | 如果本地文件是最新的,則為true,否則為false。 |