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 File
file
boolean
isCached
Whether theCacheSpan
is cached.String
key
The cache key that uniquely identifies the resource.long
lastTouchTimestamp
The last touch timestamp, orC.TIME_UNSET
ifisCached
is false.long
length
The length of theCacheSpan
, orC.LENGTH_UNSET
if this is an open-ended hole.long
position
The position of theCacheSpan
in 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 int
compareTo(CacheSpan another)
boolean
isHoleSpan()
Returns whether this is a holeCacheSpan
.boolean
isOpenEnded()
Returns whether this is an open-endedCacheSpan
.String
toString()
-
-
-
Field Detail
-
key
public final String key
The cache key that uniquely identifies the resource.
-
position
public final long position
The position of theCacheSpan
in the resource.
-
length
public final long length
The length of theCacheSpan
, orC.LENGTH_UNSET
if this is an open-ended hole.
-
isCached
public final boolean isCached
Whether theCacheSpan
is cached.
-
file
@Nullable public final File file
-
lastTouchTimestamp
public final long lastTouchTimestamp
The last touch timestamp, orC.TIME_UNSET
ifisCached
is 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 theCacheSpan
in the resource.length
- The length of theCacheSpan
, orC.LENGTH_UNSET
if 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 theCacheSpan
in the resource.length
- The length of theCacheSpan
, orC.LENGTH_UNSET
if this is an open-ended hole.lastTouchTimestamp
- The last touch timestamp, orC.TIME_UNSET
ifisCached
is false.file
- The file corresponding to thisCacheSpan
, or null if it's a hole.
-
-