GCSFileDownloaderBase
public
class
GCSFileDownloaderBase
extends GCSCommon
| java.lang.Object | ||
| ↳ | com.android.tradefed.util.gcs.GCSCommon | |
| ↳ | com.android.tradefed.util.gcs.GCSFileDownloaderBase | |
Google Cloud Storage(GCS)からファイルをダウンロードするためのファイル ダウンローダー。
概要
フィールド | |
|---|---|
public
static
final
String |
GCS_APPROX_PREFIX
|
public
static
final
String |
GCS_PREFIX
|
protected
Boolean |
mCreateEmptyFile
|
パブリック コンストラクタ | |
|---|---|
GCSFileDownloaderBase()
|
|
GCSFileDownloaderBase(Boolean createEmptyFile)
|
|
パブリック メソッド | |
|---|---|
static
File
|
createTempFileForRemote(String remoteFilePath, File rootDir)
指定されたパスでダウンロードしたファイルを格納するための一意のファイルを一時ディスクに作成します。 |
InputStream
|
downloadFile(String bucketName, String filename)
GCS バケット ファイルからファイルをダウンロードします。 |
void
|
downloadFile(String remotePath, File destFile)
|
File
|
downloadFile(String remoteFilePath)
|
StorageObject
|
getRemoteFileMetaData(String bucketName, String remoteFilename)
|
boolean
|
isRemoteFolder(String bucketName, String filename)
指定したファイル名がフォルダかどうかを確認します。 |
String
|
sanitizeDirectoryName(String name)
|
保護されたメソッド | |
|---|---|
File
|
createTempFile(String remoteFilePath, File rootDir)
|
void
|
downloadFile(String bucketName, String remoteFilename, File localFile)
|
Storage
|
getStorage()
|
void
|
listRemoteFilesUnderFolder(String bucketName, String folder,
|
String[]
|
parseGcsPath(String remotePath)
|
フィールド
GCS_APPROX_PREFIX
public static final String GCS_APPROX_PREFIX
GCS_PREFIX
public static final String GCS_PREFIX
mCreateEmptyFile
protected Boolean mCreateEmptyFile
パブリック コンストラクタ
GCSFileDownloaderBase
public GCSFileDownloaderBase ()
GCSFileDownloaderBase
public GCSFileDownloaderBase (Boolean createEmptyFile)
| パラメータ | |
|---|---|
createEmptyFile |
Boolean |
パブリック メソッド
createTempFileForRemote
public static File createTempFileForRemote (String remoteFilePath,
File rootDir)一時ディスクに一意のファイルを作成し、指定されたパスのダウンロード ファイルを格納します。
パスのベースファイル名に基づいてファイル名を作成します。
| パラメータ | |
|---|---|
remoteFilePath |
String: 名前の作成元となるリモートパス |
rootDir |
File |
| 戻り値 | |
|---|---|
File |
|
downloadFile
public InputStream downloadFile (String bucketName,
String filename)GCS バケット ファイルからファイルをダウンロードします。
| パラメータ | |
|---|---|
bucketName |
String: GCS バケット名 |
filename |
String: ファイル名 |
| 戻り値 | |
|---|---|
InputStream |
ERROR(/InputStream) は、ファイルの内容に置き換えます。 |
downloadFile
public void downloadFile (String remotePath,
File destFile)| パラメータ | |
|---|---|
remotePath |
String |
destFile |
File |
downloadFile
public File downloadFile (String remoteFilePath)
| パラメータ | |
|---|---|
remoteFilePath |
String |
| 戻り値 | |
|---|---|
File |
|
getRemoteFileMetaData
public StorageObject getRemoteFileMetaData (String bucketName,
String remoteFilename)| パラメータ | |
|---|---|
bucketName |
String |
remoteFilename |
String |
| 戻り値 | |
|---|---|
StorageObject |
|
isRemoteFolder
public boolean isRemoteFolder (String bucketName,
String filename)指定したファイル名がフォルダかどうかを確認します。
GCS には 2 種類のフォルダがあります。1. UI から明示的に作成されます。フォルダはサイズ 0 のテキスト ファイル(オブジェクト)です。2. ファイルをアップロードすると、その親フォルダがすべて作成されますが、これらのフォルダは gcs に存在しません(オブジェクトではありません)。この関数はどちらのケースでも機能します。ただし、サイズ 0 のフォルダはダウンロードしないでください。
| パラメータ | |
|---|---|
bucketName |
String: gcs バケット名。 |
filename |
String: バケットの相対パス。 |
| 戻り値 | |
|---|---|
boolean |
ファイル名がフォルダの場合は true、それ以外の場合は false。 |
sanitizeDirectoryName
public String sanitizeDirectoryName (String name)
| パラメータ | |
|---|---|
name |
String |
| 戻り値 | |
|---|---|
String |
|
保護されたメソッド
createTempFile
protected File createTempFile (String remoteFilePath,
File rootDir)| パラメータ | |
|---|---|
remoteFilePath |
String |
rootDir |
File |
| 戻り値 | |
|---|---|
File |
|
downloadFile
protected void downloadFile (String bucketName,
String remoteFilename,
File localFile)| パラメータ | |
|---|---|
bucketName |
String |
remoteFilename |
String |
localFile |
File |
getStorage
protected Storage getStorage ()
| 戻り値 | |
|---|---|
Storage |
|
listRemoteFilesUnderFolder
protected void listRemoteFilesUnderFolder (String bucketName,
String folder,
subFiles,
subFolders) | パラメータ | |
|---|---|
bucketName |
String |
folder |
String |
subFiles |
|
subFolders |
|
parseGcsPath
protected String[] parseGcsPath (String remotePath)
| パラメータ | |
|---|---|
remotePath |
String |
| 戻り値 | |
|---|---|
String[] |
|