GCSBucketUtil
public
class
GCSBucketUtil
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.util.GCSBucketUtil |
מנהל קבצים להורדה ולהעלאה של קבצים מ-Google Cloud Storage (GCS).
אסור להשתמש בכיתה הזו בהיקף של בדיקה (כלומר, IRemoteTest). האפשרות הזו יצאה משימוש. במקומה צריך להשתמש ב-GCSFileDownloader.
סיכום
כיתות מוטמעות | |
|---|---|
class |
GCSBucketUtil.GCSFileMetadata
עטיפה פשוטה לפרטי קובץ ב-GCS. |
constructors ציבוריים | |
|---|---|
GCSBucketUtil(String bucketName)
|
|
methods ציבוריים | |
|---|---|
CommandResult
|
copy(String source, String dest)
מעתיקים קובץ או ספרייה אל או מה-bucket. |
int
|
getAttempts()
|
String
|
getBotoConfig()
|
String
|
getBotoPath()
|
String
|
getBucketName()
|
boolean
|
getNoClobber()
|
boolean
|
getParallel()
|
boolean
|
getRecursive()
|
long
|
getRetryInterval()
|
long
|
getTimeout()
|
boolean
|
isFile(String path)
בודקים אם קובץ GCS הוא קובץ או לא קובץ (תיקייה). |
List<String>
|
ls(Path bucketPath)
הצגת רשימת קבצים בנתיב GCS. |
CommandResult
|
makeBucket(String projectId)
יוצרים את קטגוריית GCS. |
String
|
md5Hash(File localFile)
מחשבים את גיבוב ה-md5 של הקובץ המקומי. |
CommandResult
|
pull(Path bucketPath)
הורדה של קובץ או ספרייה מקטגוריית GCS לספרייה הנוכחית. |
CommandResult
|
pull(Path bucketPath, File localFile)
הורדת קובץ או ספרייה מקטגוריית GCS. |
String
|
pullContents(Path bucketPath)
הורדת קובץ מקטגוריית GCS וחילוץ התוכן שלו. |
CommandResult
|
push(File localFile)
העלאה של קובץ או ספרייה מקומיים לדלי GCS. |
CommandResult
|
push(File localFile, Path bucketPath)
העלאה של קובץ או ספרייה מקומיים ל-bucket ב-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()
|
constructors ציבוריים
GCSBucketUtil
public GCSBucketUtil (String bucketName)
| פרמטרים | |
|---|---|
bucketName |
String |
methods ציבוריים
copy
public CommandResult copy (String source, String dest)
מעתיקים קובץ או ספרייה אל או מה-bucket.
| פרמטרים | |
|---|---|
source |
String: קובץ מקור או תבנית |
dest |
String: קובץ או תבנית של קובץ היעד |
| החזרות | |
|---|---|
CommandResult |
התוצאה של הפעולה CommandResult. |
| הקפצת הודעות שגיאה (throw) | |
|---|---|
IOException |
|
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 |
האם מדובר בקובץ או לא. |
| הקפצת הודעות שגיאה (throw) | |
|---|---|
|
java.io.IOException |
IOException |
|
ls
public List<String> ls (Path bucketPath)
הצגת רשימת קבצים בנתיב GCS.
| פרמטרים | |
|---|---|
bucketPath |
Path: הנתיב ב-GCS |
| החזרות | |
|---|---|
List<String> |
רשימה של Strings שהם קבצים בנתיב GCS |
| הקפצת הודעות שגיאה (throw) | |
|---|---|
|
java.io.IOException |
IOException |
|
makeBucket
public CommandResult makeBucket (String projectId)
יוצרים את קטגוריית GCS.
| פרמטרים | |
|---|---|
projectId |
String |
| החזרות | |
|---|---|
CommandResult |
התוצאה של הפעולה CommandResult. |
| הקפצת הודעות שגיאה (throw) | |
|---|---|
|
java.io.IOException |
IOException |
|
md5Hash
public String md5Hash (File localFile)
מחשבים את גיבוב ה-md5 של הקובץ המקומי.
| פרמטרים | |
|---|---|
localFile |
File: קובץ מקומי |
| החזרות | |
|---|---|
String |
גיבוב MD5 של הקובץ המקומי. |
| הקפצת הודעות שגיאה (throw) | |
|---|---|
|
java.io.IOException |
IOException |
|
שליפת הודעות
public CommandResult pull (Path bucketPath)
הורדה של קובץ או ספרייה מקטגוריית GCS לספרייה הנוכחית.
| פרמטרים | |
|---|---|
bucketPath |
Path: נתיב הקובץ בדליקט GCS |
| החזרות | |
|---|---|
CommandResult |
התוצאה של הפעולה CommandResult. |
| הקפצת הודעות שגיאה (throw) | |
|---|---|
IOException |
|
שליפת הודעות
public CommandResult pull (Path bucketPath, File localFile)
הורדת קובץ או ספרייה מקטגוריית GCS.
| פרמטרים | |
|---|---|
bucketPath |
Path: נתיב הקובץ בדליקט GCS |
localFile |
File: נתיב יעד מקומי |
| החזרות | |
|---|---|
CommandResult |
התוצאה של הפעולה CommandResult. |
| הקפצת הודעות שגיאה (throw) | |
|---|---|
IOException |
|
pullContents
public String pullContents (Path bucketPath)
הורדת קובץ מקטגוריית GCS וחילוץ התוכן שלו.
| פרמטרים | |
|---|---|
bucketPath |
Path: נתיב הקובץ בדליקט GCS |
| החזרות | |
|---|---|
String |
תוכן המחרוזת של הקובץ |
| הקפצת הודעות שגיאה (throw) | |
|---|---|
IOException |
|
דחיפת הודעות
public CommandResult push (File localFile)
העלאה של קובץ או ספרייה מקומיים לדלי GCS.
| פרמטרים | |
|---|---|
localFile |
File: קובץ או ספרייה מקומיים |
| החזרות | |
|---|---|
CommandResult |
התוצאה של הפעולה CommandResult. |
| הקפצת הודעות שגיאה (throw) | |
|---|---|
IOException |
|
דחיפת הודעות
public CommandResult push (File localFile, Path bucketPath)
העלאה של קובץ או ספרייה מקומיים ל-bucket ב-GCS עם נתיב ספציפי.
| פרמטרים | |
|---|---|
localFile |
File: קובץ או ספרייה מקומיים |
bucketPath |
Path: נתיב הקובץ בדליקט GCS |
| החזרות | |
|---|---|
CommandResult |
התוצאה של הפעולה CommandResult. |
| הקפצת הודעות שגיאה (throw) | |
|---|---|
IOException |
|
pushString
public CommandResult pushString (String contents, Path bucketPath)
העלאת מחרוזת לקטגוריית GCS.
| פרמטרים | |
|---|---|
contents |
String: תוכן הקובץ, כמחרוזת |
bucketPath |
Path: נתיב הקובץ בדליקט GCS |
| החזרות | |
|---|---|
CommandResult |
התוצאה של הפעולה CommandResult. |
| הקפצת הודעות שגיאה (throw) | |
|---|---|
IOException |
|
הסרה
public CommandResult remove (String pattern, boolean force)
מסירים קובץ או ספרייה מהקטגוריה.
| פרמטרים | |
|---|---|
pattern |
String: קובץ, ספרייה או תבנית להסרה. |
force |
boolean: האם להתעלם מכשלים ולהמשיך בשקט (לא יופעל חריג) |
| החזרות | |
|---|---|
CommandResult |
|
| הקפצת הודעות שגיאה (throw) | |
|---|---|
IOException |
|
הסרה
public CommandResult remove (Path path, boolean force)
מסירים קובץ או ספרייה מהקטגוריה.
| פרמטרים | |
|---|---|
path |
Path: הנתיב להסרה |
force |
boolean: האם להפסיק את הפעולה אם הקובץ לא קיים |
| החזרות | |
|---|---|
CommandResult |
|
| הקפצת הודעות שגיאה (throw) | |
|---|---|
IOException |
|
הסרה
public CommandResult remove (Path path)
מסירים קובץ או ספרייה מהקטגוריה.
| פרמטרים | |
|---|---|
path |
Path: הנתיב להסרה |
| החזרות | |
|---|---|
CommandResult |
|
| הקפצת הודעות שגיאה (throw) | |
|---|---|
IOException |
|
הסרה
public CommandResult remove (String pattern)
מסירים קובץ או ספרייה מהקטגוריה.
| פרמטרים | |
|---|---|
pattern |
String: קובץ, ספרייה או תבנית להסרה. |
| החזרות | |
|---|---|
CommandResult |
|
| הקפצת הודעות שגיאה (throw) | |
|---|---|
IOException |
|
removeBucket
public CommandResult removeBucket ()
הסרת קטגוריית ה-GCS
| החזרות | |
|---|---|
CommandResult |
|
| הקפצת הודעות שגיאה (throw) | |
|---|---|
|
java.io.IOException |
IOException |
|
setAttempts
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 |
stat
public GCSBucketUtil.GCSFileMetadata stat (Path bucketPath)
קבלת המצב של הקובץ בנתיב GCS.
| פרמטרים | |
|---|---|
bucketPath |
Path: הנתיב ב-GCS |
| החזרות | |
|---|---|
GCSBucketUtil.GCSFileMetadata |
GCSFileMetadata GCS path |
| הקפצת הודעות שגיאה (throw) | |
|---|---|
|
java.io.IOException |
IOException |
|