GCS文件下載器

public class GCSFileDownloader
extends GCSCommon implements IFileDownloader

java.lang.Object
com.android.tradefed.util.GCSCommon
com.android.tradefed.util.GCSFileDownloader


文件下載器從谷歌云存儲(GCS)下載文件。

概括

領域

public static final String GCS_APPROX_PREFIX

public static final String GCS_PREFIX

公共構造函數

GCSFileDownloader (File jsonKeyFile)
GCSFileDownloader ()

公共方法

InputStream downloadFile (String bucketName, String filename)

從 GCS 存儲桶文件下載文件。

void downloadFile (String remotePath, File destFile)

downloadFile(String)的替代形式,允許調用者指定遠程內容應放置的目標文件。

File downloadFile (String remoteFilePath)

從 GCS 下載文件。

boolean isFresh (File localFile, String remotePath)

檢查本地文件的新鮮度。

受保護的方法

void clearCache ()

領域

GCS_APPROX_PREFIX

public static final String GCS_APPROX_PREFIX

GCS_PREFIX

public static final String GCS_PREFIX

公共構造函數

GCS文件下載器

public GCSFileDownloader (File jsonKeyFile)

參數
jsonKeyFile File

GCS文件下載器

public GCSFileDownloader ()

公共方法

下載文件

public InputStream downloadFile (String bucketName, 
                String filename)

從 GCS 存儲桶文件下載文件。

參數
bucketName String :GCS 存儲桶名稱

filename String :文件名

退貨
InputStream ERROR(/InputStream)文件內容。

下載文件

public void downloadFile (String remotePath, 
                File destFile)

downloadFile(String)的替代形式,允許調用者指定遠程內容應放置的目標文件。

參數
remotePath String :要下載的文件的遠程路徑,相對於特定於實現的根目錄。

destFile File : 將下載內容放入的文件。不應該存在。

投擲
BuildRetrievalError

下載文件

public File downloadFile (String remoteFilePath)

從 GCS 下載文件。

目前僅支持 GCS 路徑。

參數
remoteFilePath String : gs://bucket/file/path 格式 GCS 路徑。

退貨
File本地文件

投擲
com.android.tradefed.build.BuildRetrievalError
BuildRetrievalError

是新鮮的

public boolean isFresh (File localFile, 
                String remotePath)

檢查本地文件的新鮮度。如果本地文件與遠程文件相同,則它是新鮮的。如果不是,則本地文件已過時。這個主要用於緩存。默認實現將始終返回 true,因此如果文件是不可變的,則永遠不需要檢查新鮮度。

參數
localFile File :本地文件。

remotePath String : 遠程文件路徑。

退貨
boolean如果本地文件是新的則為真,否則為假。

投擲
BuildRetrievalError

受保護的方法

清除緩存

protected void clearCache ()