GCSFileUploader

public class GCSFileUploader
extends GCSCommon

java.lang.Object
   ↳ com.android.tradefed.util.gcs.GCSCommon
     ↳ com.android.tradefed.util.GCSFileUploader


檔案上傳工具,可將檔案資料上傳至 Google Cloud Storage (GCS)。

摘要

公用建構函式

GCSFileUploader()
GCSFileUploader(File jsonKeyFile)

公用方法

void uploadFile(String bucketName, String gcsFilename, InputStream fileContents, String contentType, boolean allowOverwrite)

將資料上傳至 GCS bucket 檔案。

受保護的方法

Storage getStorage(Collection<String> scopes)

覆寫基本實作項目,以支援根據 TF 選項的憑證。

公用建構函式

GCSFileUploader

public GCSFileUploader ()

GCSFileUploader

public GCSFileUploader (File jsonKeyFile)

參數
jsonKeyFile File

公用方法

uploadFile

public void uploadFile (String bucketName, 
                String gcsFilename, 
                InputStream fileContents, 
                String contentType, 
                boolean allowOverwrite)

將資料上傳至 GCS bucket 檔案。gs://[bucketName]/[gcsFileName]

參數
bucketName String:GCS bucket 名稱

gcsFilename String:檔案名稱。

fileContents InputStream:要寫入 GCS 檔案的資料 InputStream。

contentType String:這是要上傳物件的 MIME 媒體類型。

allowOverwrite boolean:設為 True 時,這個方法會覆寫 GCS 上的檔案。

擲回
IOException

受保護的方法

getStorage

protected Storage getStorage (Collection<String> scopes)

覆寫基礎中的實作項目,以支援根據 TF 選項的憑證。

參數
scopes Collection:要求憑證的特定範圍。

傳回
Storage GCS bucket 的 Storage 物件

擲回
java.io.IOException
IOException