파일다운로드캐시
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 |
가져오기원격파일
public void fetchRemoteFile (IFileDownloader downloader, String remoteFilePath, File destFile)
파일을 다운로드하거나 캐시를 대상 파일에 연결합니다.
매개변수 | |
---|---|
downloader | IFileDownloader : IFileDownloader |
remoteFilePath | String : 원격 파일. |
destFile | File : 다운로드 대상 파일입니다. |
던지기 | |
---|---|
| com.android.tradefed.build.BuildRetrievalError |
BuildRetrievalError |
가져오기원격파일
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 |