GCSBucketUtil

public class GCSBucketUtil
extends Object

java.lang.Object
com.android.tradefed.util.GCSBucketUtil


מנהל קבצים כדי להוריד ולהעלות קבצים מ-Google Cloud Storage (GCS).

אין להשתמש במחלקה זו מתוך היקף מבחן (כלומר, IRemoteTest). זה הוצא משימוש, אנא השתמש במקום זאת GCSFileDownloader .

סיכום

כיתות מקוננות

class GCSBucketUtil.GCSFileMetadata

מעטפת פשוטה למידע על קובץ ב-GCS.

בנאים ציבוריים

GCSBucketUtil (String bucketName)

שיטות ציבוריות

CommandResult copy (String source, String dest)

העתק קובץ או ספרייה אל הדלי או ממנו.

int getAttempts ()
String getBotoConfig ()
String getBotoPath ()
String getBucketName ()
boolean getNoClobber ()
boolean getParallel ()
boolean getRecursive ()
long getRetryInterval ()
long getTimeout ()
boolean isFile (String path)

בדוק שקובץ GCS הוא קובץ או לא קובץ (תיקיה).

ls (Path bucketPath)

רשום קבצים תחת נתיב GCS.

CommandResult makeBucket (String projectId)

הכינו את דלי GCS.

String md5Hash (File localFile)

חשב את ה-hash של md5 עבור הקובץ המקומי.

CommandResult pull (Path bucketPath, File localFile)

הורד קובץ או ספרייה מדלי GCS.

CommandResult pull (Path bucketPath)

הורד קובץ או ספרייה מדלי GCS לספרייה הנוכחית.

String pullContents (Path bucketPath)

הורד קובץ מדלי GCS וחלץ את תוכנו.

CommandResult push (File localFile)

העלה קובץ או ספריה מקומיים לדלי GCS.

CommandResult push (File localFile, Path bucketPath)

העלה קובץ או ספריה מקומיים לדלי GCS עם נתיב ספציפי.

CommandResult pushString (String contents, Path bucketPath)

העלה מחרוזת לדלי GCS.

CommandResult remove (String pattern, boolean force)

הסר קובץ או ספרייה מהדלי.

CommandResult remove (Path path, boolean force)

הסר קובץ או ספרייה מהדלי.

CommandResult remove (Path path)

הסר קובץ או ספרייה מהדלי.

CommandResult remove (String pattern)

הסר קובץ או ספרייה מהדלי.

CommandResult removeBucket ()

הסר את דלי GCS

void setAttempts (int attempts)
void setBotoConfig (String botoConfig)
void setBotoPath (String botoPath)
void setBucketName (String bucketName)
void setNoClobber (boolean noClobber)
void setParallel (boolean parallel)
void setRecursive (boolean recursive)
void setRetryInterval (long retryInterval)
void setTimeout (long timeout, TimeUnit unit)
void setTimeoutMs (long timeout)
GCSBucketUtil.GCSFileMetadata stat (Path bucketPath)

קבל את מצב הקובץ עבור נתיב GCS.

שיטות מוגנות

IRunUtil getRunUtil ()

בנאים ציבוריים

GCSBucketUtil

public GCSBucketUtil (String bucketName)

פרמטרים
bucketName String

שיטות ציבוריות

עותק

public CommandResult copy (String source, 
                String dest)

העתק קובץ או ספרייה אל הדלי או ממנו.

פרמטרים
source String : קובץ מקור או דפוס

dest String : קובץ יעד או דפוס

החזרות
CommandResult CommandResult תוצאת הפעולה.

getAttempts

public int getAttempts ()

החזרות
int

getBotoConfig

public String getBotoConfig ()

החזרות
String

getBotoPath

public String getBotoPath ()

החזרות
String

getBucketName

public String getBucketName ()

החזרות
String

getNoClobber

public boolean getNoClobber ()

החזרות
boolean

getParallel

public boolean getParallel ()

החזרות
boolean

getRecursive

public boolean getRecursive ()

החזרות
boolean

getRetryInterval

public long getRetryInterval ()

החזרות
long

getTimeout

public long getTimeout ()

החזרות
long

isFile

public boolean isFile (String path)

בדוק שקובץ GCS הוא קובץ או לא קובץ (תיקיה).

אם שם הקובץ מסתיים ב-'/', אז זו תיקיה. gsutil ls gs://filename צריך להחזיר את gs://filename אם זה קובץ. gsutil ls gs://folder name אמור להחזיר את הקבצים בתיקייה אם יש קבצים בתיקייה. וזה יחזיר gs://folder/ אם אין קבצים בתיקייה.

פרמטרים
path String : הנתיב ביחס לדלי..

החזרות
boolean זה קובץ או לא קובץ.

זורק
IOException

ls

public  ls (Path bucketPath)

רשום קבצים תחת נתיב GCS.

פרמטרים
bucketPath Path : נתיב GCS

החזרות
רשימה של String שהם קבצים מתחת לנתיב GCS

זורק
IOException

makeBucket

public CommandResult makeBucket (String projectId)

הכינו את דלי GCS.

פרמטרים
projectId String

החזרות
CommandResult CommandResult תוצאת הפעולה.

זורק
IOException

md5Hash

public String md5Hash (File localFile)

חשב את ה-hash של md5 עבור הקובץ המקומי.

פרמטרים
localFile File : קובץ מקומי

החזרות
String ה-hash md5 עבור הקובץ המקומי.

זורק
IOException

מְשׁוֹך

public CommandResult pull (Path bucketPath, 
                File localFile)

הורד קובץ או ספרייה מדלי GCS.

פרמטרים
bucketPath Path : נתיב קובץ בדלי GCS

localFile File : נתיב יעד מקומי

החזרות
CommandResult CommandResult תוצאת הפעולה.

מְשׁוֹך

public CommandResult pull (Path bucketPath)

הורד קובץ או ספרייה מדלי GCS לספרייה הנוכחית.

פרמטרים
bucketPath Path : נתיב קובץ בדלי GCS

החזרות
CommandResult CommandResult תוצאת הפעולה.

pullContents

public String pullContents (Path bucketPath)

הורד קובץ מדלי GCS וחלץ את תוכנו.

פרמטרים
bucketPath Path : נתיב קובץ בדלי GCS

החזרות
String תוכן מחרוזת של הקובץ

לִדחוֹף

public CommandResult push (File localFile)

העלה קובץ או ספריה מקומיים לדלי GCS.

פרמטרים
localFile File : קובץ מקומי או ספריה

החזרות
CommandResult CommandResult תוצאת הפעולה.

לִדחוֹף

public CommandResult push (File localFile, 
                Path bucketPath)

העלה קובץ או ספריה מקומיים לדלי GCS עם נתיב ספציפי.

פרמטרים
localFile File : קובץ מקומי או ספריה

bucketPath Path : נתיב קובץ בדלי GCS

החזרות
CommandResult CommandResult תוצאת הפעולה.

pushString

public CommandResult pushString (String contents, 
                Path bucketPath)

העלה מחרוזת לדלי GCS.

פרמטרים
contents String : תוכן הקובץ, כמחרוזת

bucketPath Path : נתיב קובץ בדלי GCS

החזרות
CommandResult CommandResult תוצאת הפעולה.

לְהַסִיר

public CommandResult remove (String pattern, 
                boolean force)

הסר קובץ או ספרייה מהדלי.

פרמטרים
pattern String : קובץ, ספרייה או דפוס להסרה.

force boolean : האם להתעלם מכשלים ולהמשיך בשקט (לא יזרוק)

החזרות
CommandResult

לְהַסִיר

public CommandResult remove (Path path, 
                boolean force)

הסר קובץ או ספרייה מהדלי.

פרמטרים
path Path : נתיב להסרה

force boolean : האם להיכשל אם הקובץ לא קיים

החזרות
CommandResult

לְהַסִיר

public CommandResult remove (Path path)

הסר קובץ או ספרייה מהדלי.

פרמטרים
path Path : נתיב להסרה

החזרות
CommandResult

לְהַסִיר

public CommandResult remove (String pattern)

הסר קובץ או ספרייה מהדלי.

פרמטרים
pattern String : קובץ, ספרייה או דפוס להסרה.

החזרות
CommandResult

RemoveBucket

public CommandResult removeBucket ()

הסר את דלי GCS

החזרות
CommandResult

זורק
IOException

קבע ניסיונות

public void setAttempts (int attempts)

פרמטרים
attempts int

setBotoConfig

public void setBotoConfig (String botoConfig)

פרמטרים
botoConfig String

setBotoPath

public void setBotoPath (String botoPath)

פרמטרים
botoPath String

setBucketName

public void setBucketName (String bucketName)

פרמטרים
bucketName String

setNoClobber

public void setNoClobber (boolean noClobber)

פרמטרים
noClobber boolean

setParallel

public void setParallel (boolean parallel)

פרמטרים
parallel boolean

setRecursive

public void setRecursive (boolean recursive)

פרמטרים
recursive boolean

setRetryInterval

public void setRetryInterval (long retryInterval)

פרמטרים
retryInterval long

setTimeout

public void setTimeout (long timeout, 
                TimeUnit unit)

פרמטרים
timeout long

unit TimeUnit

setTimeoutMs

public void setTimeoutMs (long timeout)

פרמטרים
timeout long

סטט

public GCSBucketUtil.GCSFileMetadata stat (Path bucketPath)

קבל את מצב הקובץ עבור נתיב GCS.

פרמטרים
bucketPath Path : נתיב GCS

החזרות
GCSBucketUtil.GCSFileMetadata GCSFileMetadata עבור נתיב GCS

זורק
IOException

שיטות מוגנות

getRunUtil

protected IRunUtil getRunUtil ()

החזרות
IRunUtil