FileDownloadCache
public class FileDownloadCache
extends Object
java.lang.Object | |
↳ | com.android.tradefed.build.FileDownloadCache |
ダウンロードしたファイルのローカル ファイルシステム LRU キャッシュを維持するヘルパー クラス。
まとめ
公開メソッド | |
---|---|
void | deleteCacheEntry (String remoteFilePath) キャッシュからのエントリの削除を許可します。 |
void | fetchRemoteFile ( IFileDownloader downloader, String remoteFilePath, File destFile) ファイルをダウンロードするか、キャッシュを宛先ファイルにリンクします。 |
File | fetchRemoteFile ( IFileDownloader downloader, String remoteFilePath) 指定されたremotePathに対応するローカル ファイルを返します ローカルの |
void | setMaxCacheSize (long numBytes) ローカル ファイル キャッシュの最大サイズを設定します。 |
保護されたメソッド | |
---|---|
void | lockFile (String remoteFilePath) ファイルのロックを取得します。 |
boolean | tryLockFile (String remoteFilePath) ファイルが別のスレッドによって保持されていない場合にのみ、ファイルのロックを取得します。 |
void | unlockFile (String remoteFilePath) ファイルのロックを解放しようとします。 |
公開メソッド
deleteCacheEntry
public void deleteCacheEntry (String remoteFilePath)
キャッシュからのエントリの削除を許可します。エントリが無効または破損している場合。
パラメーター | |
---|---|
remoteFilePath | String |
fetchRemoteFile
public void fetchRemoteFile (IFileDownloader downloader, String remoteFilePath, File destFile)
ファイルをダウンロードするか、キャッシュを宛先ファイルにリンクします。
パラメーター | |
---|---|
downloader | IFileDownloader : IFileDownloader |
remoteFilePath | String : リモート ファイル。 |
destFile | File : ダウンロード先のファイル。 |
スロー | |
---|---|
| com.android.tradefed.build.BuildRetrievalError |
BuildRetrievalError |
fetchRemoteFile
public File fetchRemoteFile (IFileDownloader downloader, String remoteFilePath)
指定されたremotePathに対応するローカル ファイルを返します
ローカルのERROR(/File)
存在する場合はキャッシュからコピーされ、存在しない場合は指定されたIFileDownloader
を介してダウンロードされます。
パラメーター | |
---|---|
downloader | IFileDownloader : IFileDownloader |
remoteFilePath | String : リモート ファイル。 |
戻り値 | |
---|---|
File | remotePath の内容を含むローカルERROR(/File) |
スロー | |
---|---|
BuildRetrievalError | ファイルを取得できなかった場合 |
setMaxCacheSize
public void setMaxCacheSize (long numBytes)
ローカル ファイル キャッシュの最大サイズを設定します。
現在よりも小さいサイズに設定されている場合、キャッシュはすぐには調整されませんが、次のファイルのダウンロードで有効になります。
保護されたメソッド
ロックファイル
protected void lockFile (String remoteFilePath)
ファイルのロックを取得します。
パラメーター | |
---|---|
remoteFilePath | String |
tryLockFile
protected boolean tryLockFile (String remoteFilePath)
ファイルが別のスレッドによって保持されていない場合にのみ、ファイルのロックを取得します。
パラメーター | |
---|---|
remoteFilePath | String |
戻り値 | |
---|---|
boolean | ロックが取得された場合は true、それ以外の場合は false。 |
ロック解除ファイル
protected void unlockFile (String remoteFilePath)
ファイルのロックを解放しようとします。
パラメーター | |
---|---|
remoteFilePath | String |