IFileDownloader
public
interface
IFileDownloader
| com.android.tradefed.build.IFileDownloader |
下載遠端檔案的介面。
摘要
公用方法 | |
|---|---|
default
void
|
acquireDownloadPermit()
如果支援並發布並行處理限制,請取得下載許可。 |
default
void
|
downloadFile(String remoteFilePath, File destFile, long startOffset, long size)
|
abstract
void
|
downloadFile(String relativeRemotePath, File destFile)
|
abstract
File
|
downloadFile(String remoteFilePath)
將遠端檔案下載至本機磁碟上的暫存檔案。 |
default
void
|
downloadZippedFiles(File destDir, String remoteFilePath,
下載符合指定篩選條件的遠端 ZIP 檔案檔案。 |
default
boolean
|
isFresh(File localFile, String remoteFilePath)
檢查本機檔案的最新性。 |
default
void
|
releaseDownloadPermit()
如果支援並發布下載許可。 |
公用方法
acquireDownloadPermit
public void acquireDownloadPermit ()
如果支援並發布並行下載限制,請取得下載許可。
downloadFile
public void downloadFile (String remoteFilePath,
File destFile,
long startOffset,
long size)downloadFile(String, File) 的替代形式,可讓呼叫端下載檔案的某個部分,並儲存至特定目的地檔案。
| 參數 | |
|---|---|
remoteFilePath |
String:相對於特定實作根目錄的下載檔案遠端路徑。 |
destFile |
File:下載內容的目標檔案。不應存在。 |
startOffset |
long:遠端檔案中的起始偏移量。 |
size |
long:從遠端檔案下載的位元組數量。將其設為負值,即可下載整個檔案。 |
| 擲回 | |
|---|---|
BuildRetrievalError |
無法下載檔案 |
downloadFile
public abstract void downloadFile (String relativeRemotePath,
File destFile)downloadFile(String) 的替代形式,可讓呼叫端指定應放置遠端內容的目標檔案。
| 參數 | |
|---|---|
relativeRemotePath |
String:相對於特定實作根目錄的下載檔案遠端路徑。 |
destFile |
File:下載內容的目標檔案。不應存在。 |
| 擲回 | |
|---|---|
BuildRetrievalError |
無法下載檔案 |
downloadFile
public abstract File downloadFile (String remoteFilePath)
將遠端檔案下載至本機磁碟上的暫存檔案。
| 參數 | |
|---|---|
remoteFilePath |
String:相對於實作特定根目錄的遠端檔案路徑。 |
| 傳回 | |
|---|---|
File |
臨時下載的 ERROR(/File)。 |
| 擲回 | |
|---|---|
BuildRetrievalError |
如果無法下載檔案 |
downloadZippedFiles
public void downloadZippedFiles (File destDir,
String remoteFilePath,
includeFilters,
excludeFilters) 下載符合指定篩選條件的遠端 ZIP 檔案檔案。
遠端 ZIP 檔案中的檔案只會下載至路徑符合任何包含篩選器的檔案,但不包含排除篩選器。
| 參數 | |
|---|---|
destDir |
File:下載內容的目標檔案。 |
remoteFilePath |
String:相對於實作特定根目錄的檔案遠端路徑。 |
includeFilters |
:下載相符檔案的篩選器清單。 |
excludeFilters |
:用於略過下載符合檔案的篩選器清單。 |
| 擲回 | |
|---|---|
BuildRetrievalError |
無法下載檔案。 |
|
IOException |
isFresh
public boolean isFresh (File localFile,
String remoteFilePath)檢查本機檔案的更新頻率。如果本機檔案與遠端檔案相同,則表示檔案為最新版本。否則,本機檔案就會過時。這項功能主要用於快取。預設實作方式一律會傳回 true,因此如果檔案不可變更,就不需要檢查新鮮度。
| 參數 | |
|---|---|
localFile |
File:本機檔案。 |
remoteFilePath |
String:遠端檔案路徑。 |
| 傳回 | |
|---|---|
boolean |
如果本機檔案為最新版本,則傳回「是」;否則傳回「否」。 |
| 擲回 | |
|---|---|
|
com.android.tradefed.build.BuildRetrievalError |
BuildRetrievalError |
|
releaseDownloadPermit
public void releaseDownloadPermit ()
如果支援並發布下載許可,則會顯示並發布下載許可。