public 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. |
Constructor and Description |
---|
CacheSpan(String key,
long position,
long length)
Creates a hole CacheSpan which isn't cached, has no last access time and no file associated.
|
CacheSpan(String key,
long position,
long length,
long lastAccessTimestamp,
File file)
Creates a CacheSpan.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(CacheSpan another) |
boolean |
isHoleSpan()
Returns whether this is a hole
CacheSpan . |
boolean |
isOpenEnded()
Returns whether this is an open-ended
CacheSpan . |
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 long lastAccessTimestamp
C.TIME_UNSET
if isCached
is false.public CacheSpan(String key, long position, long length)
key
- The cache key that uniquely identifies the original stream.position
- The position of the CacheSpan
in the original stream.length
- The length of the CacheSpan
, or C.LENGTH_UNSET
if this is an
open-ended hole.public CacheSpan(String key, long position, long length, long lastAccessTimestamp, @Nullable File file)
key
- The cache key that uniquely identifies the original stream.position
- The position of the CacheSpan
in the original stream.length
- The length of the CacheSpan
, or C.LENGTH_UNSET
if this is an
open-ended hole.lastAccessTimestamp
- The last access timestamp, or C.TIME_UNSET
if isCached
is false.file
- The file corresponding to this CacheSpan
, or null if it's a hole.public boolean isOpenEnded()
CacheSpan
.public boolean isHoleSpan()
CacheSpan
.public int compareTo(@NonNull CacheSpan another)
compareTo
in interface Comparable<CacheSpan>