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(File jsonKeyFile)
GCSFileDownloader(File jsonKeyFile, Boolean createEmptyFile)
GCSFileDownloader(Boolean createEmptyFile)

パブリック メソッド

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(Collection<String> scopes)

TF オプションに基づく認証情報をサポートするために、ベースの実装をオーバーライドします。

String[] parseGcsPath(String remotePath)

パブリック コンストラクタ

GCSFileDownloader

public GCSFileDownloader ()

GCSFileDownloader

public GCSFileDownloader (File jsonKeyFile)

パラメータ
jsonKeyFile File

GCSFileDownloader

public GCSFileDownloader (File jsonKeyFile, 
                Boolean createEmptyFile)

パラメータ
jsonKeyFile File

createEmptyFile Boolean

GCSFileDownloader

public GCSFileDownloader (Boolean createEmptyFile)

パラメータ
createEmptyFile Boolean

パブリック メソッド

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 ローカル ファイルが新しい場合は true、それ以外の場合は false。

例外
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 (Collection<String> scopes)

TF オプションに基づく認証情報をサポートするために、ベースの実装をオーバーライドします。

パラメータ
scopes Collection: 認証情報をリクエストする特定のスコープ。

戻り値
Storage GCS バケットの Storage オブジェクト

例外
java.io.IOException
IOException

parseGcsPath

protected String[] parseGcsPath (String remotePath)

パラメータ
remotePath String

戻り値
String[]

例外
BuildRetrievalError