Class CachedRegionTracker
- java.lang.Object
-
- com.google.android.exoplayer2.upstream.CachedRegionTracker
-
- All Implemented Interfaces:
Cache.Listener
@Deprecated public final class CachedRegionTracker extends Object implements Cache.Listener
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 aCache
for a given cache key.
-
-
Field Summary
Fields Modifier and Type Field Description static int
CACHED_TO_END
Deprecated.static int
NOT_CACHED
Deprecated.
-
Constructor Summary
Constructors Constructor Description CachedRegionTracker(Cache cache, String cacheKey, ChunkIndex chunkIndex)
Deprecated.
-
Method Summary
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 aCacheSpan
is added to the cache.void
onSpanRemoved(Cache cache, CacheSpan span)
Deprecated.Called when aCacheSpan
is removed from the cache.void
onSpanTouched(Cache cache, CacheSpan oldSpan, CacheSpan newSpan)
Deprecated.Called when an existingCacheSpan
is touched, causing it to be replaced.void
release()
Deprecated.
-
-
-
Field Detail
-
NOT_CACHED
public static final int NOT_CACHED
Deprecated.- See Also:
- Constant Field Values
-
CACHED_TO_END
public static final int CACHED_TO_END
Deprecated.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CachedRegionTracker
public CachedRegionTracker(Cache cache, String cacheKey, ChunkIndex chunkIndex)
Deprecated.
-
-
Method Detail
-
release
public void release()
Deprecated.
-
getRegionEndTimeMs
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 thenNOT_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
, orCACHED_TO_END
.
-
onSpanAdded
public void onSpanAdded(Cache cache, CacheSpan span)
Deprecated.Description copied from interface:Cache.Listener
Called when aCacheSpan
is added to the cache.- Specified by:
onSpanAdded
in interfaceCache.Listener
- Parameters:
cache
- The source of the event.span
- The addedCacheSpan
.
-
onSpanRemoved
public void onSpanRemoved(Cache cache, CacheSpan span)
Deprecated.Description copied from interface:Cache.Listener
Called when aCacheSpan
is removed from the cache.- Specified by:
onSpanRemoved
in interfaceCache.Listener
- Parameters:
cache
- The source of the event.span
- The removedCacheSpan
.
-
onSpanTouched
public void onSpanTouched(Cache cache, CacheSpan oldSpan, CacheSpan newSpan)
Deprecated.Description copied from interface:Cache.Listener
Called when an existingCacheSpan
is touched, causing it to be replaced. The newCacheSpan
is guaranteed to represent the same data as the one it replaces, howeverCacheSpan.file
andCacheSpan.lastTouchTimestamp
may have changed.Note that for span replacement,
Cache.Listener.onSpanAdded(Cache, CacheSpan)
andCache.Listener.onSpanRemoved(Cache, CacheSpan)
are not called in addition to this method.- Specified by:
onSpanTouched
in interfaceCache.Listener
- Parameters:
cache
- The source of the event.oldSpan
- The oldCacheSpan
, which has been removed from the cache.newSpan
- The newCacheSpan
, which has been added to the cache.
-
-