FileDownloadCacheWrapper

public class FileDownloadCacheWrapper
extends Object implements IFileDownloader

java.lang.Object
   ↳ com.android.tradefed.build.FileDownloadCacheWrapper


IFileDownloader インターフェースを実装しながら FileDownloadCache 機能を提供するラッパー クラス。

呼び出し元からキャッシュの使用を抽象化する場合に便利です。

概要

パブリック コンストラクタ

FileDownloadCacheWrapper(File cacheDir, IFileDownloader delegateDownloader)

パブリック メソッド

void downloadFile(String remoteFilePath, File destFile)

downloadFile(String) の別の形式。呼び出し元がリモート コンテンツを配置する宛先ファイルを指定できます。

File downloadFile(String remoteFilePath)

リモート ファイルをローカル ディスク上の一時ファイルにダウンロードします。

void downloadZippedFiles(File destDir, String remoteFilePath, includeFilters, excludeFilters)

指定されたフィルタに一致するファイルをリモートの zip ファイルにダウンロードします。

boolean isFresh(File localFile, String remoteFilePath)

ローカル ファイルの更新頻度を確認します。

パブリック コンストラクタ

FileDownloadCacheWrapper

public FileDownloadCacheWrapper (File cacheDir, 
                IFileDownloader delegateDownloader)

パラメータ
cacheDir File

delegateDownloader IFileDownloader

パブリック メソッド

downloadFile

public void downloadFile (String remoteFilePath, 
                File destFile)

downloadFile(String) の代替形式。呼び出し元がリモート コンテンツを配置する宛先ファイルを指定できます。

パラメータ
remoteFilePath String: 実装固有のルートからの相対パスで、ダウンロードするファイルのパス。

destFile File: ダウンロードしたコンテンツを配置するファイル。存在しない。

例外
BuildRetrievalError

downloadFile

public File downloadFile (String remoteFilePath)

リモート ファイルをローカル ディスク上の一時ファイルにダウンロードします。

パラメータ
remoteFilePath String: 実装固有のルートからの相対パスで、ダウンロードするファイルへのリモートパス。

戻り値
File 一時的なローカルにダウンロードされた ERROR(/File)

例外
BuildRetrievalError

downloadZippedFiles

public void downloadZippedFiles (File destDir, 
                String remoteFilePath, 
                 includeFilters, 
                 excludeFilters)

指定されたフィルタに一致するファイルをリモートの zip ファイルにダウンロードします。

リモート ZIP ファイル内のファイルは、パスが包含フィルタのいずれかと一致する場合にのみダウンロードされますが、除外フィルタとは一致しません。

パラメータ
destDir File: ダウンロードしたコンテンツを配置するファイル。

remoteFilePath String: 実装固有のルートからの相対パスで、ダウンロードするファイルへのリモートパス。

includeFilters : 一致するファイルをダウンロードするフィルタのリスト。

excludeFilters : 一致するファイルのダウンロードをスキップするフィルタのリスト。

例外
BuildRetrievalError

isFresh

public boolean isFresh (File localFile, 
                String remoteFilePath)

ローカル ファイルの更新頻度を確認します。ローカル ファイルがリモート ファイルと同じ場合は、新規です。更新されていない場合、ローカル ファイルは古い状態です。これは主にキャッシュに使用されます。デフォルトの実装では常に true が返されるため、ファイルが不変であれば、新しさをチェックする必要はありません。

パラメータ
localFile File: ローカル ファイル。

remoteFilePath String: リモート ファイルパス。

戻り値
boolean ローカル ファイルが新規の場合は true、それ以外の場合は false。

例外
BuildRetrievalError