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 aCachefor a given cache key.
-
-
Field Summary
Fields Modifier and Type Field Description static intCACHED_TO_ENDDeprecated.static intNOT_CACHEDDeprecated.
-
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 intgetRegionEndTimeMs(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.voidonSpanAdded(Cache cache, CacheSpan span)Deprecated.Called when aCacheSpanis added to the cache.voidonSpanRemoved(Cache cache, CacheSpan span)Deprecated.Called when aCacheSpanis removed from the cache.voidonSpanTouched(Cache cache, CacheSpan oldSpan, CacheSpan newSpan)Deprecated.Called when an existingCacheSpanis touched, causing it to be replaced.voidrelease()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_CACHEDis returned. If the cached region extends to the end of the stream,CACHED_TO_ENDis 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.ListenerCalled when aCacheSpanis added to the cache.- Specified by:
onSpanAddedin 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.ListenerCalled when aCacheSpanis removed from the cache.- Specified by:
onSpanRemovedin 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.ListenerCalled when an existingCacheSpanis touched, causing it to be replaced. The newCacheSpanis guaranteed to represent the same data as the one it replaces, howeverCacheSpan.fileandCacheSpan.lastTouchTimestampmay 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:
onSpanTouchedin 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.
-
-