自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
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)
下载与给定过滤条件匹配的远程 zip 文件中的文件。
|
boolean
|
isFresh(File localFile, String remoteFilePath)
检查本地文件的新鲜度。
|
公共构造函数
FileDownloadCacheWrapper
public FileDownloadCacheWrapper (File cacheDir,
IFileDownloader delegateDownloader)
参数 |
cacheDir |
File |
delegateDownloader |
IFileDownloader |
公共方法
downloadFile
public void downloadFile (String remoteFilePath,
File destFile)
downloadFile(String)
的替代形式,允许调用方指定应将远程内容放入的目的地文件。
参数 |
remoteFilePath |
String :相对于特定实现的根目录的要下载的文件的远程路径。 |
destFile |
File :要将下载内容放入其中的文件。不应存在。 |
downloadFile
public File downloadFile (String remoteFilePath)
将远程文件下载到本地磁盘上的临时文件。
参数 |
remoteFilePath |
String :相对于实现专用根目录的要下载的文件的远程路径。 |
downloadZippedFiles
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。 |
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-26。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-26。"],[],[]]