ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
GCSBucketUtil
public
class
GCSBucketUtil
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.util.GCSBucketUtil
|
เครื่องมือจัดการไฟล์สำหรับดาวน์โหลดและอัปโหลดไฟล์จาก Google Cloud Storage (GCS)
ไม่ควรใช้คลาสนี้จากขอบเขตการทดสอบ (เช่น IRemoteTest) การตั้งค่านี้เลิกใช้งานแล้ว โปรดใช้ GCSFileDownloader
แทน
สรุป
เมธอดสาธารณะ |
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)
คํานวณแฮช 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
|
ตัวสร้างแบบสาธารณะ
GCSBucketUtil
public GCSBucketUtil (String bucketName)
พารามิเตอร์ |
bucketName |
String |
เมธอดสาธารณะ
คัดลอก
public CommandResult copy (String source,
String dest)
คัดลอกไฟล์หรือไดเรกทอรีไปยังหรือจากที่เก็บข้อมูล
พารามิเตอร์ |
source |
String : ไฟล์ต้นฉบับหรือรูปแบบ |
dest |
String : ไฟล์หรือรูปแบบปลายทาง |
getAttempts
public int getAttempts ()
getBotoConfig
public String getBotoConfig ()
getBotoPath
public String getBotoPath ()
getBucketName
public String getBucketName ()
getNoClobber
public boolean getNoClobber ()
getParallel
public boolean getParallel ()
getRecursive
public boolean getRecursive ()
getRetryInterval
public long getRetryInterval ()
getTimeout
public long getTimeout ()
isFile
public boolean isFile (String path)
ตรวจสอบว่าไฟล์ GCS เป็นไฟล์หรือไม่ใช่ไฟล์ (โฟลเดอร์)
หากชื่อไฟล์ลงท้ายด้วย "/" แสดงว่าเป็นโฟลเดอร์ gsutil ls gs://filename ควรแสดงผล gs://filename หากเป็นไฟล์ gsutil ls gs://folder name ควรแสดงไฟล์ในโฟลเดอร์ หากมีไฟล์ในโฟลเดอร์ และจะแสดงผล gs://folder/ หากไม่มีไฟล์ในโฟลเดอร์
พารามิเตอร์ |
path |
String : เส้นทางที่สัมพันธ์กับที่เก็บข้อมูล.. |
คิกรีเทิร์น |
boolean |
ไฟล์หรือไม่เป็นไฟล์ |
ls
public ls (Path bucketPath)
แสดงรายการไฟล์ในเส้นทาง GCS
พารามิเตอร์ |
bucketPath |
Path : เส้นทาง GCS |
คิกรีเทิร์น |
|
รายการ String ที่คือไฟล์ในเส้นทาง GCS |
makeBucket
public CommandResult makeBucket (String projectId)
สร้างที่เก็บข้อมูล GCS
พารามิเตอร์ |
projectId |
String |
md5Hash
public String md5Hash (File localFile)
คํานวณแฮช MD5 สําหรับไฟล์ในเครื่อง
พารามิเตอร์ |
localFile |
File : ไฟล์ในเครื่อง |
คิกรีเทิร์น |
String |
แฮช MD5 ของไฟล์ในเครื่อง |
ดึง
public CommandResult pull (Path bucketPath,
File localFile)
ดาวน์โหลดไฟล์หรือไดเรกทอรีจากที่เก็บข้อมูล GCS
พารามิเตอร์ |
bucketPath |
Path : เส้นทางไฟล์ในที่เก็บข้อมูล GCS |
localFile |
File : เส้นทางปลายทางภายใน |
ดึง
public CommandResult pull (Path bucketPath)
ดาวน์โหลดไฟล์หรือไดเรกทอรีจากที่เก็บข้อมูล GCS ไปยังไดเรกทอรีปัจจุบัน
พารามิเตอร์ |
bucketPath |
Path : เส้นทางไฟล์ในที่เก็บข้อมูล GCS |
pullContents
public String pullContents (Path bucketPath)
ดาวน์โหลดไฟล์จากที่เก็บข้อมูล GCS และดึงเนื้อหาของไฟล์
พารามิเตอร์ |
bucketPath |
Path : เส้นทางไฟล์ในที่เก็บข้อมูล GCS |
คิกรีเทิร์น |
String |
เนื้อหาสตริงของไฟล์
|
กด
public CommandResult push (File localFile)
อัปโหลดไฟล์หรือไดเรกทอรีในเครื่องไปยังที่เก็บข้อมูล GCS
พารามิเตอร์ |
localFile |
File : ไฟล์หรือไดเรกทอรีในเครื่อง |
กด
public CommandResult push (File localFile,
Path bucketPath)
อัปโหลดไฟล์หรือไดเรกทอรีในเครื่องไปยังที่เก็บข้อมูล GCS ด้วยเส้นทางที่เฉพาะเจาะจง
พารามิเตอร์ |
localFile |
File : ไฟล์หรือไดเรกทอรีในเครื่อง |
bucketPath |
Path : เส้นทางไฟล์ในที่เก็บข้อมูล GCS |
pushString
public CommandResult pushString (String contents,
Path bucketPath)
อัปโหลดสตริงไปยังที่เก็บข้อมูล GCS
พารามิเตอร์ |
contents |
String : เนื้อหาไฟล์ในรูปแบบสตริง |
bucketPath |
Path : เส้นทางไฟล์ในที่เก็บข้อมูล GCS |
นำข้อมูลออก
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 |
|
setAttempts
public void setAttempts (int attempts)
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)
วิธีการที่มีการป้องกัน
getRunUtil
protected IRunUtil getRunUtil ()
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-03-26 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-03-26 UTC"],[],[]]