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 : ダウンロードの宛先ファイル。 |
例外 | |
---|---|
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)
ローカル ファイル キャッシュの最大サイズを設定します。
現在のサイズより小さいサイズに設定した場合、キャッシュはすぐに調整されませんが、次のファイルのダウンロード時に有効になります。
保護されたメソッド
lockFile
protected void lockFile (String remoteFilePath)
ファイルのロックが取得されます。
パラメータ | |
---|---|
remoteFilePath |
String |
tryLockFile
protected boolean tryLockFile (String remoteFilePath)
ファイルのロックは、別のスレッドで保持されていない場合にのみ取得します。
パラメータ | |
---|---|
remoteFilePath |
String |
戻り値 | |
---|---|
boolean |
ロックが取得された場合は true、それ以外の場合は false。 |
unlockFile
protected void unlockFile (String remoteFilePath)
ファイルのロック解除を試みます。
パラメータ | |
---|---|
remoteFilePath |
String |