파일다운로드캐시
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 |
원격 파일 가져오기
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 |
tryLock파일
protected boolean tryLockFile (String remoteFilePath)
다른 스레드가 파일을 보유하지 않는 경우에만 파일에 대한 잠금을 획득하십시오.
매개변수 | |
---|---|
remoteFilePath | String |
보고 | |
---|---|
boolean | 잠금이 획득되면 true이고, 그렇지 않으면 false입니다. |
잠금해제파일
protected void unlockFile (String remoteFilePath)
파일에 대한 잠금을 해제하려고 합니다.
매개변수 | |
---|---|
remoteFilePath | String |