IFileDownloader

public interface IFileDownloader

com.android.tradefed.build.IFileDownloader


Interface for downloading a remote file.

Summary

Public methods

abstract void downloadFile(String relativeRemotePath, File destFile)

Alternate form of downloadFile(String), that allows caller to specify the destination file the remote contents should be placed in.

abstract File downloadFile(String remoteFilePath)

Downloads a remote file to a temporary file on local disk.

default boolean isFresh(File localFile, String remoteFilePath)

Check local file's freshness.

Public methods

downloadFile

public abstract void downloadFile (String relativeRemotePath, 
                File destFile)

Alternate form of downloadFile(String), that allows caller to specify the destination file the remote contents should be placed in.

Parameters
relativeRemotePath String: the remote path to the file to download, relative to an implementation-specific root.

destFile File: the file to place the downloaded contents into. Should not exist.

Throws
BuildRetrievalError if file could not be downloaded

downloadFile

public abstract File downloadFile (String remoteFilePath)

Downloads a remote file to a temporary file on local disk.

Parameters
remoteFilePath String: the remote path to the file to download, relative to a implementation specific root.

Returns
File the temporary local downloaded ERROR(/File).

Throws
BuildRetrievalError if file could not be downloaded

isFresh

public boolean isFresh (File localFile, 
                String remoteFilePath)

Check local file's freshness. If local file is the same as remote file, then it's fresh. If not, local file is stale. This is mainly used for cache. The default implementation will always return true, so if the file is immutable it will never need to check freshness.

Parameters
localFile File: local file.

remoteFilePath String: remote file path.

Returns
boolean True if local file is fresh, otherwise false.

Throws
BuildRetrievalError