AndroidBuildFetcher

public class AndroidBuildFetcher
extends Object

java.lang.Object
   ↳ com.google.android.tradefed.build.AndroidBuildFetcher


用于从 Android Build API 下载文件的辅助类。

摘要

公共构造函数

AndroidBuildFetcher(String buildEnv)

AndroidBuildFetcher 的构造函数。

公共方法

void fetchArtifact(String target, String buildId, String resourceId, String attemptId, File outputFile)

将制品下载到本地文件。

void fetchArtifact(String target, String buildId, String resourceId, String attemptId, File outputFile, long startOffset, long size)

将制品的一部分下载到具有指定范围的本地文件。

void fetchDeviceBlob(String deviceName, String binaryType, String version, File outputFile)

将设备 blob 下载到本地文件。

BuildArtifactMetadata getArtifactMetadata(String target, String buildId, String resourceId, String attemptId)

获取 build 制品的元数据。

void setUseMd5(boolean useMd5)

公共构造函数

AndroidBuildFetcher

public AndroidBuildFetcher (String buildEnv)

AndroidBuildFetcher 的构造函数。

参数
buildEnv String:要使用的 Build API 环境。

抛出
java.io.IOException
java.security.GeneralSecurityException
GeneralSecurityException
IOException

公共方法

fetchArtifact

public void fetchArtifact (String target, 
                String buildId, 
                String resourceId, 
                String attemptId, 
                File outputFile)

将制品下载到本地文件。

参数
target String:制品目标。如果为 null,下载将会失败。

buildId String:制品 buildId。如果为 null,下载将会失败。

resourceId String:要下载的文件名。如果为 null,下载将会失败。

attemptId String:最新版本、当前版本或尝试 ID,默认值为最新版本。

outputFile File:将文件下载到此本地文件。

抛出
com.android.tradefed.build.BuildRetrievalError
java.io.IOException
BuildRetrievalError
IOException

fetchArtifact

public void fetchArtifact (String target, 
                String buildId, 
                String resourceId, 
                String attemptId, 
                File outputFile, 
                long startOffset, 
                long size)

将制品的一部分下载到具有指定范围的本地文件。

参数
target String:制品目标。如果为 null,下载将会失败。

buildId String:制品 buildId。如果为 null,下载将会失败。

resourceId String:要下载的文件名。如果为 null,下载将会失败。

attemptId String:最新版本、当前版本或尝试 ID,默认值为最新版本。

outputFile File:将文件下载到此本地文件。

startOffset long:要下载的文件的起始偏移量。

size long:要下载的字节数。将其设置为负值可提取整个文件。

抛出
com.android.tradefed.build.BuildRetrievalError
java.io.IOException
BuildRetrievalError
IOException

fetchDeviceBlob

public void fetchDeviceBlob (String deviceName, 
                String binaryType, 
                String version, 
                File outputFile)

将设备 blob 下载到本地文件。

参数
deviceName String:如果此值为 null,下载将失败。

binaryType String:radio.img 或 bootloader.img。如果此值为 null,下载将会失败。

version String:设备版本。如果此值为 null,下载将会失败。

outputFile File:本地文件。将 Blob 下载到此本地文件。

抛出
java.io.IOException
IOException

getArtifactMetadata

public BuildArtifactMetadata getArtifactMetadata (String target, 
                String buildId, 
                String resourceId, 
                String attemptId)

获取 build 制品的元数据。

参数
target String:制品目标。如果为 null,下载将会失败。

buildId String:制品 buildId。如果为 null,下载将会失败。

resourceId String:要下载的文件名。如果为 null,下载将会失败。

attemptId String:最新版本、当前版本或尝试 ID,默认值为最新版本。

返回
BuildArtifactMetadata BuildArtifactMetadata 对象。

抛出
java.io.IOException
IOException

setUseMd5

public void setUseMd5 (boolean useMd5)

参数
useMd5 boolean