FileDownloadCacheWrapper
public class FileDownloadCacheWrapper
extends Object
implements IFileDownloader
java.lang.Object |
↳ | com.android.tradefed.build.FileDownloadCacheWrapper |
IFileDownloader
インターフェイスの実装中にFileDownloadCache
機能を提供するラッパークラス。
呼び出し元からキャッシュの使用を抽象化したい場合に役立ちます。
概要
パブリックメソッド |
---|
void | downloadFile (String remoteFilePath, File destFile) downloadFile(String) 代替形式。これにより、呼び出し元はリモートコンテンツを配置する宛先ファイルを指定できます。 |
File | downloadFile (String remoteFilePath) リモートファイルをローカルディスクの一時ファイルにダウンロードします。 |
void | downloadZippedFiles (File destDir, String remoteFilePath, includeFilters, excludeFilters) downloadZippedFiles (File destDir, String remoteFilePath, includeFilters, excludeFilters) 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 |
パブリックメソッド
ダウンロードファイル
public void downloadFile (String remoteFilePath,
File destFile)
downloadFile(String)
代替形式。これにより、呼び出し元はリモートコンテンツを配置する宛先ファイルを指定できます。
パラメーター |
---|
remoteFilePath | String :実装固有のルートを基準にした、ダウンロードするファイルへのリモートパス。 |
destFile | File :ダウンロードしたコンテンツを配置するファイル。存在すべきではありません。 |
ダウンロードファイル
public File downloadFile (String remoteFilePath)
リモートファイルをローカルディスクの一時ファイルにダウンロードします。
パラメーター |
---|
remoteFilePath | String :実装固有のルートを基準にした、ダウンロードするファイルへのリモートパス。 |
downloadZippedFiles
public void downloadZippedFiles (File destDir,
String remoteFilePath,
includeFilters,
excludeFilters)
指定されたフィルターに一致するファイルをリモートzipファイルにダウンロードします。
リモートzipファイル内のファイルは、そのパスにのみダウンロードされ、包含フィルターのいずれかに一致しますが、除外フィルターには一致しません。
パラメーター |
---|
destDir | File :ダウンロードしたコンテンツを配置するファイル。 |
remoteFilePath | String :実装固有のルートを基準にした、ダウンロードするファイルへのリモートパス。 |
includeFilters | :一致するファイルをダウンロードするためのフィルターのリスト。 |
excludeFilters | :一致するファイルのダウンロードをスキップするフィルターのリスト。 |
isFresh
public boolean isFresh (File localFile,
String remoteFilePath)
ローカルファイルの鮮度を確認してください。ローカルファイルがリモートファイルと同じである場合、それは新しいものです。そうでない場合、ローカルファイルは古くなっています。これは主にキャッシュに使用されます。デフォルトの実装は常にtrueを返すため、ファイルが不変である場合、鮮度をチェックする必要はありません。
パラメーター |
---|
localFile | File :ローカルファイル。 |
remoteFilePath | String :リモートファイルパス。 |
戻り値 |
---|
boolean | ローカルファイルが新しい場合はtrue、それ以外の場合はfalse。 |