public final class CacheSpan extends Object implements Comparable<CacheSpan>
isCached
).Modifier and Type | Field and Description |
---|---|
File |
file
|
boolean |
isCached
Whether the
CacheSpan is cached. |
String |
key
The cache key that uniquely identifies the original stream.
|
long |
lastAccessTimestamp
The last access timestamp, or
C.TIME_UNSET if isCached is false. |
long |
length
The length of the
CacheSpan , or C.LENGTH_UNSET if this is an open-ended hole. |
long |
position
The position of the
CacheSpan in the original stream. |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(CacheSpan another) |
static CacheSpan |
createCacheEntry(File file)
Creates a cache span from an underlying cache file.
|
static CacheSpan |
createClosedHole(String key,
long position,
long length) |
static CacheSpan |
createLookup(String key,
long position) |
static CacheSpan |
createOpenHole(String key,
long position) |
static File |
getCacheFileName(File cacheDir,
String key,
long offset,
long lastAccessTimestamp) |
boolean |
isOpenEnded()
Returns whether this is an open-ended
CacheSpan . |
CacheSpan |
touch()
Renames the file underlying this cache span to update its last access time.
|
public final String key
public final long position
CacheSpan
in the original stream.public final long length
CacheSpan
, or C.LENGTH_UNSET
if this is an open-ended hole.public final boolean isCached
CacheSpan
is cached.public final File file
public final long lastAccessTimestamp
C.TIME_UNSET
if isCached
is false.public static File getCacheFileName(File cacheDir, String key, long offset, long lastAccessTimestamp)
public static CacheSpan createCacheEntry(File file)
file
- The cache file.public boolean isOpenEnded()
CacheSpan
.public CacheSpan touch()
CacheSpan
representing the updated cache file.public int compareTo(CacheSpan another)
compareTo
in interface Comparable<CacheSpan>