AndroidBuildFetcher

public class AndroidBuildFetcher
extends Object

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


Helper class used for downloading files from Android Build API.

Summary

Public constructors

AndroidBuildFetcher(String buildEnv)

Constructor of AndroidBuildFetcher.

Public methods

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

Download artifact to local file.

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

Download part of the artifact to local file with the given range.

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

Download device blob to local file.

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

Get the metadata of a build artifact.

void setUseMd5(boolean useMd5)

Public constructors

AndroidBuildFetcher

public AndroidBuildFetcher (String buildEnv)

Constructor of AndroidBuildFetcher.

Parameters
buildEnv String: the Build API environment to use.

Throws
java.io.IOException
java.security.GeneralSecurityException
GeneralSecurityException
IOException

Public methods

fetchArtifact

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

Download artifact to local file.

Parameters
target String: artifact target. If it's null, the download will fail.

buildId String: artifact buildId. If it's null, the download will fail.

resourceId String: the filename to download. If it's null, the download will fail.

attemptId String: latest, current or attempt id, default is latest.

outputFile File: download the file to this local file.

Throws
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)

Download part of the artifact to local file with the given range.

Parameters
target String: artifact target. If it's null, the download will fail.

buildId String: artifact buildId. If it's null, the download will fail.

resourceId String: the filename to download. If it's null, the download will fail.

attemptId String: latest, current or attempt id, default is latest.

outputFile File: download the file to this local file.

startOffset long: the start offset of the file to download.

size long: number of bytes to download. Set it to a negative value to fetch the whole file.

Throws
com.android.tradefed.build.BuildRetrievalError
java.io.IOException
BuildRetrievalError
IOException

fetchDeviceBlob

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

Download device blob to local file.

Parameters
deviceName String: If this is null, the download will fail.

binaryType String: radio.img or bootloader.img. If this is null, the download will fail.

version String: device version. If this is null, the download will fail.

outputFile File: local file. Download the blob to this local file.

Throws
java.io.IOException
IOException

getArtifactMetadata

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

Get the metadata of a build artifact.

Parameters
target String: artifact target. If it's null, the download will fail.

buildId String: artifact buildId. If it's null, the download will fail.

resourceId String: the filename to download. If it's null, the download will fail.

attemptId String: latest, current or attempt id, default is latest.

Returns
BuildArtifactMetadata a BuildArtifactMetadata object.

Throws
java.io.IOException
IOException

setUseMd5

public void setUseMd5 (boolean useMd5)

Parameters
useMd5 boolean