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에 해당하는 로컬 파일을 반환합니다.
로컬 File이 있는 경우 캐시에서 복사되고, 그렇지 않으면 지정된 IFileDownloader을 통해
다운로드됩니다.
| 매개변수 | |
|---|---|
downloader |
IFileDownloader: IFileDownloader |
remoteFilePath |
String: 원격 파일입니다. |
| 반환 | |
|---|---|
File |
remotePath의 콘텐츠가 포함된 로컬 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 |