AndroidBuildDownloader

public class AndroidBuildDownloader
extends Object implements IFileDownloader

java.lang.Object
   ↳ com.google.android.tradefed.build.AndroidBuildDownloader


從 Android Build API 擷取檔案的 IFileDownloader

摘要

欄位

protected static final ConcurrentMap<String, RemoteZip> REMOTE_ZIP_CACHE

以遠端路徑建立索引的遠端 ZIP 檔案快取。

公用建構函式

AndroidBuildDownloader()

公用方法

static File createTempFile(String remoteFilePath, File rootDir)

在暫時磁碟上建立獨一無二的檔案,用來存放指定路徑的下載檔案。

void downloadFile(String remoteFilePath, File destFile, long startOffset, long size)

downloadFile(String,File) 的替代形式,可讓呼叫端下載檔案的某個部分,並儲存至特定目的地檔案。

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 檔案的形式,下載符合指定篩選條件的檔案。

void enablePartialDownloadCache(boolean enablePartialDownloadCache)
void setMetadataCheck(boolean enableMetadataCheck)
void setResolveSymlinks(boolean resolveSymlinks)
void setUseMd5(boolean useMd5)

受保護的方法

AndroidBuildFetcher getBuildFetcher()

Returns an AndroidBuildFetcher, creating one if it does not already exist.

void setBuildEnvironment(String buildEnvironment)

欄位

REMOTE_ZIP_CACHE

protected static final ConcurrentMap<String, RemoteZip> REMOTE_ZIP_CACHE

以遠端路徑編列索引的遠端 ZIP 檔案快取。

公用建構函式

AndroidBuildDownloader

public AndroidBuildDownloader ()

公用方法

createTempFile

public static File createTempFile (String remoteFilePath, 
                File rootDir)

在暫時磁碟上建立專屬檔案,存放指定路徑的下載檔案。

根據路徑中的基本檔案名稱建構檔案名稱

參數
remoteFilePath String:用來建構名稱的遠端路徑

rootDir File

傳回
File

擲回
BuildRetrievalError

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 void downloadFile (String remoteFilePath, 
                File destFile)

downloadFile(String) 的替代形式,可讓呼叫端指定應放置遠端內容的目標檔案。

參數
remoteFilePath String:要下載的檔案遠端路徑,相對於實作專屬的根目錄。

destFile File:要將下載內容放入的檔案。不應存在。

擲回
BuildRetrievalError

downloadFile

public File downloadFile (String remoteFilePath)

將遠端檔案下載至本機磁碟的暫存檔案。

參數
remoteFilePath String:要下載的檔案的遠端路徑,相對於實作專屬根目錄。

傳回
File 暫時下載的本機檔案 File

擲回
BuildRetrievalError

downloadZippedFiles

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

以遠端 ZIP 檔案的形式,下載符合指定篩選條件的檔案。

只有在遠端 ZIP 檔案中的檔案路徑符合任何包含篩選器,但不符合排除篩選器時,才會下載該檔案。

參數
destDir File:要將下載內容放入的檔案。

remoteFilePath String:要下載的檔案的遠端路徑,相對於實作專屬根目錄。

includeFilters List:要下載相符檔案的篩選器清單。

excludeFilters List:要略過下載相符檔案的篩選器清單。

擲回
BuildRetrievalError
IOException

enablePartialDownloadCache

public void enablePartialDownloadCache (boolean enablePartialDownloadCache)

參數
enablePartialDownloadCache boolean

setMetadataCheck

public void setMetadataCheck (boolean enableMetadataCheck)

參數
enableMetadataCheck boolean

setResolveSymlinks

public void setResolveSymlinks (boolean resolveSymlinks)

參數
resolveSymlinks boolean

setUseMd5

public void setUseMd5 (boolean useMd5)

參數
useMd5 boolean

受保護的方法

getBuildFetcher

protected AndroidBuildFetcher getBuildFetcher ()

傳回 AndroidBuildFetcher,如果不存在,則建立一個。

傳回
AndroidBuildFetcher

擲回
GeneralSecurityException
IOException

setBuildEnvironment

protected void setBuildEnvironment (String buildEnvironment)

參數
buildEnvironment String