文件下載緩存包裝器

public class FileDownloadCacheWrapper
extends Object implements IFileDownloader

java.lang.Object
com.android.tradefed.build.FileDownloadCacheWrapper


一個包裝類,它在實現IFileDownloader接口時提供FileDownloadCache設施。

對於您想從調用者那裡抽像出緩存使用的情況很有用。

概括

公共構造函數

FileDownloadCacheWrapper (File cacheDir, IFileDownloader delegateDownloader)

公共方法

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)

檢查本地文件的新鮮度。

公共構造函數

文件下載緩存包裝器

public FileDownloadCacheWrapper (File cacheDir, 
                IFileDownloader delegateDownloader)

參數
cacheDir File

delegateDownloader IFileDownloader

公共方法

下載文件

public void downloadFile (String remoteFilePath, 
                File destFile)

downloadFile(String)的替代形式,允許調用者指定遠程內容應放置的目標文件。

參數
remoteFilePath String :要下載的文件的遠程路徑,相對於特定於實現的根目錄。

destFile File : 將下載內容放入的文件。不應該存在。

投擲
BuildRetrievalError

下載文件

public File downloadFile (String remoteFilePath)

將遠程文件下載到本地磁盤上的臨時文件。

參數
remoteFilePath String :要下載的文件的遠程路徑,相對於特定於實現的根目錄。

退貨
File臨時本地下載ERROR(/File)

投擲
BuildRetrievalError

下載壓縮文件

public void downloadZippedFiles (File destDir, 
                String remoteFilePath, 
                 includeFilters, 
                 excludeFilters)

在遠程 zip 文件中下載與給定過濾器匹配的文件。

遠程 zip 文件中的文件僅下載到其路徑匹配任何包含過濾器但不匹配排除過濾器。

參數
destDir File : 將下載內容放入的文件。

remoteFilePath String :要下載的文件的遠程路徑,相對於特定於實現的根目錄。

includeFilters :用於下載匹配文件的過濾器列表。

excludeFilters :用於跳過下載匹配文件的過濾器列表。

投擲
BuildRetrievalError

是新鮮的

public boolean isFresh (File localFile, 
                String remoteFilePath)

檢查本地文件的新鮮度。如果本地文件與遠程文件相同,則它是新鮮的。如果不是,則本地文件已過時。這個主要用於緩存。默認實現將始終返回 true,因此如果文件是不可變的,則永遠不需要檢查新鮮度。

參數
localFile File :本地文件。

remoteFilePath String : 遠程文件路徑。

退貨
boolean如果本地文件是新的則為真,否則為假。

投擲
BuildRetrievalError