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 |