mirror of
https://github.com/zhigang1992/AndroidVideoCache.git
synced 2026-03-29 08:49:03 +08:00
add ability to know what the file is used for file cache (FileCache.getFile())
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<groupId>com.danikula</groupId>
|
||||
<artifactId>videocache</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0</version>
|
||||
<version>1.0.1</version>
|
||||
<name>VideoCache</name>
|
||||
<description>cache support for android VideoView</description>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class FileCache implements Cache {
|
||||
|
||||
public FileCache(File file) throws ProxyCacheException {
|
||||
try {
|
||||
Preconditions.checkNotNull(file);
|
||||
checkNotNull(file);
|
||||
boolean partialFile = isTempFile(file);
|
||||
boolean completed = file.exists() && !partialFile;
|
||||
if (completed) {
|
||||
@@ -105,6 +105,15 @@ public class FileCache implements Cache {
|
||||
return !isTempFile(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns file to be used fo caching. It may as original file passed in constructor as some temp file for not completed cache.
|
||||
*
|
||||
* @return file for caching.
|
||||
*/
|
||||
public File getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
private boolean isTempFile(File file) {
|
||||
return file.getName().endsWith(TEMP_POSTFIX);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user