GCSFileDownloader
public
class
GCSFileDownloader
extends GCSFileDownloaderBase
implements
IFileDownloader
java.lang.Object | |||
↳ | com.android.tradefed.util.gcs.GCSCommon | ||
↳ | com.android.tradefed.util.gcs.GCSFileDownloaderBase | ||
↳ | com.android.tradefed.util.GCSFileDownloader |
檔案下載器,可從 Google Cloud Storage (GCS) 下載檔案。
摘要
公用建構函式 | |
---|---|
GCSFileDownloader()
|
|
GCSFileDownloader(Boolean createEmptyFile)
|
|
GCSFileDownloader(File jsonKeyFile)
|
公用方法 | |
---|---|
static
File
|
createTempFileForRemote(String remoteFilePath, File rootDir)
|
void
|
downloadFile(String remotePath, File destFile)
|
File
|
downloadFile(String remoteFilePath)
從 GCS 下載檔案。 |
boolean
|
isFresh(File localFile, String remotePath)
檢查本機檔案的最新狀態。 |
受保護的方法 | |
---|---|
void
|
clearCache()
|
void
|
downloadFile(String bucketName, String remoteFilename, File localFile)
|
Storage
|
getStorage(
覆寫 base 中的實作項目,以便支援根據 TF 選項設定的憑證。 |
String[]
|
parseGcsPath(String remotePath)
|
公用建構函式
GCSFileDownloader
public GCSFileDownloader ()
GCSFileDownloader
public GCSFileDownloader (Boolean createEmptyFile)
參數 | |
---|---|
createEmptyFile |
Boolean |
GCSFileDownloader
public GCSFileDownloader (File jsonKeyFile)
參數 | |
---|---|
jsonKeyFile |
File |
公用方法
createTempFileForRemote
public static File createTempFileForRemote (String remoteFilePath, File rootDir)
參數 | |
---|---|
remoteFilePath |
String |
rootDir |
File |
傳回 | |
---|---|
File |
擲回 | |
---|---|
BuildRetrievalError |
downloadFile
public void downloadFile (String remotePath, File destFile)
參數 | |
---|---|
remotePath |
String |
destFile |
File |
擲回 | |
---|---|
BuildRetrievalError |
downloadFile
public File downloadFile (String remoteFilePath)
從 GCS 下載檔案。
目前僅支援 GCS 路徑。
參數 | |
---|---|
remoteFilePath |
String :以 gs://bucket/file/path 格式輸入 GCS 路徑。 |
傳回 | |
---|---|
File |
本機檔案 |
擲回 | |
---|---|
|
com.android.tradefed.build.BuildRetrievalError |
BuildRetrievalError |
isFresh
public boolean isFresh (File localFile, String remotePath)
檢查本機檔案的更新頻率。如果本機檔案與遠端檔案相同,則表示檔案為最新版本。否則,本機檔案就會過時。這項功能主要用於快取。預設實作方式一律會傳回 true,因此如果檔案不可變更,就不需要檢查新鮮度。
參數 | |
---|---|
localFile |
File :本機檔案。 |
remotePath |
String :遠端檔案路徑。 |
傳回 | |
---|---|
boolean |
如果本機檔案為最新版本,則傳回「是」;否則傳回「否」。 |
擲回 | |
---|---|
BuildRetrievalError |
受保護的方法
clearCache
protected void clearCache ()
downloadFile
protected void downloadFile (String bucketName, String remoteFilename, File localFile)
參數 | |
---|---|
bucketName |
String |
remoteFilename |
String |
localFile |
File |
擲回 | |
---|---|
BuildRetrievalError |
getStorage
protected Storage getStorage (scopes)
覆寫 base 中的實作項目,以便支援根據 TF 選項設定的憑證。
參數 | |
---|---|
scopes |
:要要求憑證的特定範圍。 |
傳回 | |
---|---|
Storage |
GCS 值區的 Storage 物件 |
擲回 | |
---|---|
|
IOException |
parseGcsPath
protected String[] parseGcsPath (String remotePath)
參數 | |
---|---|
remotePath |
String |
傳回 | |
---|---|
String[] |
擲回 | |
---|---|
BuildRetrievalError |