CasFileDownloader

public class CasFileDownloader
extends Object implements IFileDownloader

java.lang.Object
   ↳ com.google.android.tradefed.util.CasFileDownloader


檔案下載器,可從 RBE CAS 下載檔案。

摘要

公用建構函式

CasFileDownloader(IFileDownloader fallbackDownloader, File manifestPath, boolean casAutoDiscovery, boolean casChunk, boolean casChunkDir)

CasFileDownloader 的建構函式。

CasFileDownloader(IFileDownloader fallbackDownloader, File cacheDir, File manifestPath, boolean casAutoDiscovery, boolean casChunk, boolean casChunkDir, File casServiceAccountJson, File tempFileRoot, IRunUtil runUtil)

公用方法

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

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

void downloadFile(String relativeRemotePath, File destFile)

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

File downloadFile(String remoteFilePath)

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

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

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

static CasOptions getCasOptions()
void setCasChunksOptions(boolean casKeepChunks, boolean casChunksOnly)
void setCasConcurrency(long casConcurrency)
void setCasMemoryLimit(long casMemoryLimit)
void setCasRpcTimeout(long casRpcTimeout, long casGetCapabilitiesTimeout, long casBatchUpdateBlobsTimeout, long casBatchReadBlobsTimeout, long casGetTreeTimeout)

受保護的方法

File extractCasClient(String clientName)

公用建構函式

CasFileDownloader

public CasFileDownloader (IFileDownloader fallbackDownloader, 
                File manifestPath, 
                boolean casAutoDiscovery, 
                boolean casChunk, 
                boolean casChunkDir)

CasFileDownloader 的建構函式。

參數
fallbackDownloader IFileDownloader:如果 CAS 檔案下載器無法初始化,或無法從 CAS 下載檔案,則使用此檔案下載器。

manifestPath File

casAutoDiscovery boolean

casChunk boolean:是否要下載分塊版本 (如果兩個版本都可下載)。

casChunkDir boolean:是否要將未壓縮的區塊版本下載為目錄。

CasFileDownloader

public CasFileDownloader (IFileDownloader fallbackDownloader, 
                File cacheDir, 
                File manifestPath, 
                boolean casAutoDiscovery, 
                boolean casChunk, 
                boolean casChunkDir, 
                File casServiceAccountJson, 
                File tempFileRoot, 
                IRunUtil runUtil)

參數
fallbackDownloader IFileDownloader

cacheDir File

manifestPath File

casAutoDiscovery boolean

casChunk boolean

casChunkDir boolean

casServiceAccountJson File

tempFileRoot File

runUtil IRunUtil

公用方法

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 relativeRemotePath, 
                File destFile)

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

參數
relativeRemotePath 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

getCasOptions

public static CasOptions getCasOptions ()

傳回
CasOptions

setCasChunksOptions

public void setCasChunksOptions (boolean casKeepChunks, 
                boolean casChunksOnly)

參數
casKeepChunks boolean

casChunksOnly boolean

setCasConcurrency

public void setCasConcurrency (long casConcurrency)

參數
casConcurrency long

setCasMemoryLimit

public void setCasMemoryLimit (long casMemoryLimit)

參數
casMemoryLimit long

setCasRpcTimeout

public void setCasRpcTimeout (long casRpcTimeout, 
                long casGetCapabilitiesTimeout, 
                long casBatchUpdateBlobsTimeout, 
                long casBatchReadBlobsTimeout, 
                long casGetTreeTimeout)

參數
casRpcTimeout long

casGetCapabilitiesTimeout long

casBatchUpdateBlobsTimeout long

casBatchReadBlobsTimeout long

casGetTreeTimeout long

受保護的方法

extractCasClient

protected File extractCasClient (String clientName)

參數
clientName String

傳回
File

擲回
IOException