ファイルダウンロードキャッシュ
public class FileDownloadCache
extends Object
java.lang.オブジェクト | |
↳ | 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 |
ロックファイルを試す
protected boolean tryLockFile (String remoteFilePath)
ファイルが別のスレッドによって保持されていない場合にのみ、ファイルのロックを取得します。
パラメーター | |
---|---|
remoteFilePath | String |
戻り値 | |
---|---|
boolean | ロックが取得された場合は true、そうでない場合は false。 |
ファイルのロックを解除する
protected void unlockFile (String remoteFilePath)
ファイルのロックを解除しようとします。
パラメーター | |
---|---|
remoteFilePath | String |