GCSFileDownloader

public class GCSFileDownloader
extends GCSFileDownloaderBase implements IFileDownloader

java.lang.Object
   ↳ com.android.tradefed.util.gcs.GCSCommon
     ↳ com.android.tradefed.util.gcs.GCSFileDownloaderBase
       ↳ com.android.tradefed.util.GCSFileDownloader


Trình tải tệp xuống để tải tệp xuống từ Google Cloud Storage (GCS).

Tóm tắt

Hàm khởi tạo công khai

GCSFileDownloader()
GCSFileDownloader(File jsonKeyFile)
GCSFileDownloader(File jsonKeyFile, Boolean createEmptyFile)
GCSFileDownloader(Boolean createEmptyFile)

Phương thức công khai

static File createTempFileForRemote(String remoteFilePath, File rootDir)
void downloadFile(String remotePath, File destFile)
File downloadFile(String remoteFilePath)

Tải tệp xuống từ GCS.

boolean isFresh(File localFile, String remotePath)

Kiểm tra độ mới của tệp cục bộ.

Phương thức được bảo vệ

void clearCache()
void downloadFile(String bucketName, String remoteFilename, File localFile)
Storage getStorage(Collection<String> scopes)

Ghi đè việc triển khai trong cơ sở để hỗ trợ thông tin đăng nhập dựa trên các lựa chọn TF.

String[] parseGcsPath(String remotePath)

Hàm khởi tạo công khai

GCSFileDownloader

public GCSFileDownloader ()

GCSFileDownloader

public GCSFileDownloader (File jsonKeyFile)

Tham số
jsonKeyFile File

GCSFileDownloader

public GCSFileDownloader (File jsonKeyFile, 
                Boolean createEmptyFile)

Tham số
jsonKeyFile File

createEmptyFile Boolean

GCSFileDownloader

public GCSFileDownloader (Boolean createEmptyFile)

Tham số
createEmptyFile Boolean

Phương thức công khai

createTempFileForRemote

public static File createTempFileForRemote (String remoteFilePath, 
                File rootDir)

Tham số
remoteFilePath String

rootDir File

Giá trị trả về
File

Gửi
BuildRetrievalError

downloadFile

public void downloadFile (String remotePath, 
                File destFile)

Tham số
remotePath String

destFile File

Gửi
BuildRetrievalError

downloadFile

public File downloadFile (String remoteFilePath)

Tải tệp xuống từ GCS.

Hiện tại, chỉ hỗ trợ đường dẫn GCS.

Tham số
remoteFilePath String: Định dạng gs://bucket/file/path cho đường dẫn GCS.

Giá trị trả về
File tệp cục bộ

Gửi
com.android.tradefed.build.BuildRetrievalError
BuildRetrievalError

isFresh

public boolean isFresh (File localFile, 
                String remotePath)

Kiểm tra độ mới của tệp cục bộ. Nếu tệp cục bộ giống với tệp từ xa, thì đó là tệp mới. Nếu không, tệp trên máy đã cũ. Thao tác này chủ yếu dùng cho bộ nhớ đệm. Quá trình triển khai mặc định sẽ luôn trả về giá trị true, vì vậy, nếu tệp là bất biến thì bạn sẽ không bao giờ cần kiểm tra độ mới.

Tham số
localFile File: tệp cục bộ.

remotePath String: đường dẫn đến tệp từ xa.

Giá trị trả về
boolean True nếu tệp trên máy là tệp mới, ngược lại là false.

Gửi
BuildRetrievalError

Phương thức được bảo vệ

clearCache

protected void clearCache ()

downloadFile

protected void downloadFile (String bucketName, 
                String remoteFilename, 
                File localFile)

Tham số
bucketName String

remoteFilename String

localFile File

Gửi
BuildRetrievalError

getStorage

protected Storage getStorage (Collection<String> scopes)

Ghi đè việc triển khai trong cơ sở để hỗ trợ thông tin đăng nhập dựa trên các lựa chọn TF.

Tham số
scopes Collection: các phạm vi cụ thể để yêu cầu thông tin đăng nhập.

Giá trị trả về
Storage Đối tượng Storage của bộ chứa GCS

Gửi
java.io.IOException
IOException

parseGcsPath

protected String[] parseGcsPath (String remotePath)

Tham số
remotePath String

Giá trị trả về
String[]

Gửi
BuildRetrievalError