Class CacheSpan
- java.lang.Object
-
- com.google.android.exoplayer2.upstream.cache.CacheSpan
-
- All Implemented Interfaces:
Comparable<CacheSpan>
public class CacheSpan extends Object implements Comparable<CacheSpan>
Defines a span of data that may or may not be cached (as indicated byisCached).
-
-
Field Summary
Fields Modifier and Type Field Description FilefilebooleanisCachedWhether theCacheSpanis cached.StringkeyThe cache key that uniquely identifies the resource.longlastTouchTimestampThe last touch timestamp, orC.TIME_UNSETifisCachedis false.longlengthThe length of theCacheSpan, orC.LENGTH_UNSETif this is an open-ended hole.longpositionThe position of theCacheSpanin the resource.
-
Constructor Summary
Constructors Constructor Description CacheSpan(String key, long position, long length)Creates a hole CacheSpan which isn't cached, has no last touch timestamp and no file associated.CacheSpan(String key, long position, long length, long lastTouchTimestamp, File file)Creates a CacheSpan.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(CacheSpan another)booleanisHoleSpan()Returns whether this is a holeCacheSpan.booleanisOpenEnded()Returns whether this is an open-endedCacheSpan.StringtoString()
-
-
-
Field Detail
-
key
public final String key
The cache key that uniquely identifies the resource.
-
position
public final long position
The position of theCacheSpanin the resource.
-
length
public final long length
The length of theCacheSpan, orC.LENGTH_UNSETif this is an open-ended hole.
-
isCached
public final boolean isCached
Whether theCacheSpanis cached.
-
file
@Nullable public final File file
-
lastTouchTimestamp
public final long lastTouchTimestamp
The last touch timestamp, orC.TIME_UNSETifisCachedis false.
-
-
Constructor Detail
-
CacheSpan
public CacheSpan(String key, long position, long length)
Creates a hole CacheSpan which isn't cached, has no last touch timestamp and no file associated.- Parameters:
key- The cache key that uniquely identifies the resource.position- The position of theCacheSpanin the resource.length- The length of theCacheSpan, orC.LENGTH_UNSETif this is an open-ended hole.
-
CacheSpan
public CacheSpan(String key, long position, long length, long lastTouchTimestamp, @Nullable File file)
Creates a CacheSpan.- Parameters:
key- The cache key that uniquely identifies the resource.position- The position of theCacheSpanin the resource.length- The length of theCacheSpan, orC.LENGTH_UNSETif this is an open-ended hole.lastTouchTimestamp- The last touch timestamp, orC.TIME_UNSETifisCachedis false.file- The file corresponding to thisCacheSpan, or null if it's a hole.
-
-