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).

סיכום

ערכים קבועים

String GCS_APPROX_PREFIX

String GCS_PREFIX

שדות

protected Boolean mCreateEmptyFile

Constructors ציבוריים

GCSFileDownloaderBase()
GCSFileDownloaderBase(Boolean createEmptyFile)

‫methods ציבוריים

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, subFiles, subFolders)
String[] parseGcsPath(String remotePath)

ערכים קבועים

GCS_APPROX_PREFIX

public static final String GCS_APPROX_PREFIX

ערך קבוע: "gs:/"

GCS_PREFIX

public static final String GCS_PREFIX

ערך קבוע: ‎"gs://"

שדות

mCreateEmptyFile

protected Boolean mCreateEmptyFile

Constructors ציבוריים

GCSFileDownloaderBase

public GCSFileDownloaderBase ()

GCSFileDownloaderBase

public GCSFileDownloaderBase (Boolean createEmptyFile)

פרמטרים
createEmptyFile Boolean

‫methods ציבוריים

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)

בודקים אם שם הקובץ שצוין הוא תיקייה או לא.

יש 2 סוגים של תיקיות ב-GCS: 1. נוצר באופן מפורש מממשק המשתמש. התיקייה היא קובץ טקסט בגודל 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[]