文件下载缓存包装器

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如果本地文件是最新的,则为 true,否则为 false。

投掷
BuildRetrievalError