docs/doc/reference/com/google/android/exoplayer2/upstream/CachedRegionTracker.html
Package com.google.android.exoplayer2.upstream
All Implemented Interfaces:Cache.Listener
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classCachedRegionTrackerextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[Cache.Listener](cache/Cache.Listener.html "interface in com.google.android.exoplayer2.upstream.cache")
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
Utility class for efficiently tracking regions of data that are stored in a Cache for a given cache key.
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static int | CACHED_TO_END |
Deprecated.
|
| static int | NOT_CACHED |
Deprecated.
|
Constructors | Constructor | Description |
| --- | --- |
| CachedRegionTracker(Cache cache, String cacheKey, ChunkIndex chunkIndex) |
Deprecated.
|
All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| int | getRegionEndTimeMs(long byteOffset) |
Deprecated.
When provided with a byte offset, this method locates the cached region within which the offset falls, and returns the approximate end position in milliseconds of that region.
|
| void | onSpanAdded(Cache cache, CacheSpan span) |
Deprecated.
Called when a CacheSpan is added to the cache.
|
| void | onSpanRemoved(Cache cache, CacheSpan span) |
Deprecated.
Called when a CacheSpan is removed from the cache.
|
| void | onSpanTouched(Cache cache, CacheSpan oldSpan, CacheSpan newSpan) |
Deprecated.
Called when an existing CacheSpan is touched, causing it to be replaced.
|
| void | release() |
Deprecated.
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public static final int NOT_CACHED
Deprecated. See Also:Constant Field Values
-
public static final int CACHED_TO_END
Deprecated. See Also:Constant Field Values
-
public CachedRegionTracker([Cache](cache/Cache.html "interface in com.google.android.exoplayer2.upstream.cache")cache,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")cacheKey,[ChunkIndex](../extractor/ChunkIndex.html "class in com.google.android.exoplayer2.extractor")chunkIndex)
Deprecated.
-
public void release()
Deprecated.
-
public int getRegionEndTimeMs(long byteOffset)
Deprecated.
When provided with a byte offset, this method locates the cached region within which the offset falls, and returns the approximate end position in milliseconds of that region. If the byte offset does not fall within a cached region then NOT_CACHED is returned. If the cached region extends to the end of the stream, CACHED_TO_END is returned.
Parameters:byteOffset - The byte offset in the underlying stream.Returns:The end position of the corresponding cache region, NOT_CACHED, or CACHED_TO_END.
-
public void onSpanAdded([Cache](cache/Cache.html "interface in com.google.android.exoplayer2.upstream.cache")cache,[CacheSpan](cache/CacheSpan.html "class in com.google.android.exoplayer2.upstream.cache")span)
Deprecated.
Description copied from interface: Cache.Listener
Called when a CacheSpan is added to the cache.
Specified by:onSpanAdded in interface Cache.ListenerParameters:cache - The source of the event.span - The added CacheSpan.
-
public void onSpanRemoved([Cache](cache/Cache.html "interface in com.google.android.exoplayer2.upstream.cache")cache,[CacheSpan](cache/CacheSpan.html "class in com.google.android.exoplayer2.upstream.cache")span)
Deprecated.
Description copied from interface: Cache.Listener
Called when a CacheSpan is removed from the cache.
Specified by:onSpanRemoved in interface Cache.ListenerParameters:cache - The source of the event.span - The removed CacheSpan.
-
public void onSpanTouched([Cache](cache/Cache.html "interface in com.google.android.exoplayer2.upstream.cache")cache,[CacheSpan](cache/CacheSpan.html "class in com.google.android.exoplayer2.upstream.cache")oldSpan,[CacheSpan](cache/CacheSpan.html "class in com.google.android.exoplayer2.upstream.cache")newSpan)
Deprecated.
Description copied from interface: Cache.Listener
Called when an existing CacheSpan is touched, causing it to be replaced. The new CacheSpan is guaranteed to represent the same data as the one it replaces, however CacheSpan.file and CacheSpan.lastTouchTimestamp may have changed.
Note that for span replacement, Cache.Listener.onSpanAdded(Cache, CacheSpan) and Cache.Listener.onSpanRemoved(Cache, CacheSpan) are not called in addition to this method.
Specified by:onSpanTouched in interface Cache.ListenerParameters:cache - The source of the event.oldSpan - The old CacheSpan, which has been removed from the cache.newSpan - The new CacheSpan, which has been added to the cache.