Stay organized with collections
Save and categorize content based on your preferences.
FileDownloadCacheWrapper
public
class
FileDownloadCacheWrapper
extends Object
implements
IFileDownloader
java.lang.Object
|
↳ |
com.android.tradefed.build.FileDownloadCacheWrapper
|
A wrapper class that provides FileDownloadCache
facilities while implementing the
IFileDownloader
interface.
Useful for cases where you want to abstract the use of the cache from callers.
Summary
Public methods |
void
|
downloadFile(String remoteFilePath, File destFile)
Alternate form of downloadFile(String) , that allows caller to specify the
destination file the remote contents should be placed in.
|
File
|
downloadFile(String remoteFilePath)
Downloads a remote file to a temporary file on local disk.
|
void
|
downloadZippedFiles(File destDir, String remoteFilePath, includeFilters, excludeFilters)
Download the files matching given filters in a remote zip file.
|
boolean
|
isFresh(File localFile, String remoteFilePath)
Check local file's freshness.
|
Public constructors
FileDownloadCacheWrapper
public FileDownloadCacheWrapper (File cacheDir,
IFileDownloader delegateDownloader)
Parameters |
cacheDir |
File |
delegateDownloader |
IFileDownloader |
Public methods
downloadFile
public void downloadFile (String remoteFilePath,
File destFile)
Alternate form of downloadFile(String)
, that allows caller to specify the
destination file the remote contents should be placed in.
Parameters |
remoteFilePath |
String : the remote path to the file to download, relative to an
implementation-specific root. |
destFile |
File : the file to place the downloaded contents into. Should not exist. |
downloadFile
public File downloadFile (String remoteFilePath)
Downloads a remote file to a temporary file on local disk.
Parameters |
remoteFilePath |
String : the remote path to the file to download, relative to a implementation
specific root. |
downloadZippedFiles
public void downloadZippedFiles (File destDir,
String remoteFilePath,
includeFilters,
excludeFilters)
Download the files matching given filters in a remote zip file.
A file inside the remote zip file is only downloaded to its path matches any of the
include filters but not the exclude filters.
Parameters |
destDir |
File : the file to place the downloaded contents into. |
remoteFilePath |
String : the remote path to the file to download, relative to an implementation
specific root. |
includeFilters |
: a list of filters to download matching files. |
excludeFilters |
: a list of filters to skip downloading matching files. |
isFresh
public boolean isFresh (File localFile,
String remoteFilePath)
Check local file's freshness. If local file is the same as remote file, then it's fresh. If
not, local file is stale. This is mainly used for cache. The default implementation will
always return true, so if the file is immutable it will never need to check freshness.
Parameters |
localFile |
File : local file. |
remoteFilePath |
String : remote file path. |
Returns |
boolean |
True if local file is fresh, otherwise false. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-03-08 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2023-03-08 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-03-08 UTC."]]