為配合主幹穩定開發模型,並確保生態系統的平台穩定性,我們將自 2026 年起,在第 2 季和第 4 季將原始碼發布至 AOSP。如要建構及貢獻 AOSP,請使用 android-latest-release。android-latest-release 資訊清單分支版本一律會參照推送至 Android 開放原始碼計畫的最新版本。詳情請參閱「Android 開放原始碼計畫變更」。
Google 會運用 AI 技術將內容翻譯成你偏好的語言,但可能會出錯。
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
FileDownloadCacheWrapper
public
class
FileDownloadCacheWrapper
extends Object
implements
IFileDownloader
| java.lang.Object
|
| ↳ |
com.android.tradefed.build.FileDownloadCacheWrapper
|
這個 wrapper 類別會實作 IFileDownloader 介面,並提供 FileDownloadCache 設施。
如果您想從呼叫端抽象化快取的使用情形,這項功能就非常實用。
摘要
公用方法 |
void
|
downloadFile(String remoteFilePath, File destFile)
downloadFile(String) 的替代形式,可讓呼叫端指定遠端內容應放置的目標檔案。
|
File
|
downloadFile(String remoteFilePath)
將遠端檔案下載至本機磁碟的暫存檔案。
|
void
|
downloadZippedFiles(File destDir, String remoteFilePath, List<String> includeFilters, List<String> 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,
List<String> includeFilters,
List<String> excludeFilters)
以遠端 ZIP 檔案的形式,下載符合指定篩選條件的檔案。
只有在遠端 ZIP 檔案中的檔案路徑符合任何包含篩選器,但不符合排除篩選器時,才會下載該檔案。
| 參數 |
destDir |
File:要將下載內容放入的檔案。 |
remoteFilePath |
String:要下載的檔案的遠端路徑,相對於實作專屬根目錄。 |
includeFilters |
List:要下載相符檔案的篩選器清單。 |
excludeFilters |
List:要略過下載相符檔案的篩選器清單。 |
isFresh
public boolean isFresh (File localFile,
String remoteFilePath)
檢查本機檔案是否為最新版本。如果本機檔案與遠端檔案相同,則為最新版本。如果不是,本機檔案就是過時的檔案。這項功能主要用於快取。預設實作一律會傳回 true,因此如果檔案不可變更,就不需要檢查是否為最新版本。
| 參數 |
localFile |
File:本機檔案。 |
remoteFilePath |
String:遠端檔案路徑。 |
| 傳回 |
boolean |
如果本機檔案為最新版本,則為 True,否則為 False。 |
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2026-06-22 (世界標準時間)。
[[["容易理解","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"]],["上次更新時間:2026-06-22 (世界標準時間)。"],[],[]]