Class CacheWriter
- java.lang.Object
-
- com.google.android.exoplayer2.upstream.cache.CacheWriter
-
@Deprecated public final class CacheWriter extends Object
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.Caching related utility methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceCacheWriter.ProgressListenerDeprecated.Receives progress updates during cache operations.
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_BUFFER_SIZE_BYTESDeprecated.Default buffer size to be used while caching.
-
Constructor Summary
Constructors Constructor Description CacheWriter(CacheDataSource dataSource, DataSpec dataSpec, byte[] temporaryBuffer, CacheWriter.ProgressListener progressListener)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidcache()Deprecated.Caches the requested data, skipping any that's already cached.voidcancel()Deprecated.Cancels this writer's caching operation.
-
-
-
Field Detail
-
DEFAULT_BUFFER_SIZE_BYTES
public static final int DEFAULT_BUFFER_SIZE_BYTES
Deprecated.Default buffer size to be used while caching.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CacheWriter
public CacheWriter(CacheDataSource dataSource, DataSpec dataSpec, @Nullable byte[] temporaryBuffer, @Nullable CacheWriter.ProgressListener progressListener)
Deprecated.- Parameters:
dataSource- ACacheDataSourcethat writes to the target cache.dataSpec- Defines the data to be written.temporaryBuffer- A temporary buffer to be used during caching, ornullif the writer should instantiate its own internal temporary buffer.progressListener- An optional progress listener.
-
-
Method Detail
-
cancel
public void cancel()
Deprecated.Cancels this writer's caching operation.cachechecks for cancelation frequently during execution, and throws anInterruptedIOExceptionif it sees that the caching operation has been canceled.
-
cache
@WorkerThread public void cache() throws IOExceptionDeprecated.Caches the requested data, skipping any that's already cached.If the
CacheDataSourceused by the writer has aPriorityTaskManager, then it's the responsibility of the caller to callPriorityTaskManager.add(int)to register with the manager before calling this method, and to callPriorityTaskManager.remove(int)afterwards to unregister.PriorityTaskManager.PriorityTooLowExceptionwill be thrown if the priority required by theCacheDataSourceis not high enough for progress to be made.This method may be slow and shouldn't normally be called on the main thread.
- Throws:
IOException- If an error occurs reading the data, or writing the data into the cache, or if the operation is canceled. If canceled, anInterruptedIOExceptionis thrown. The method may be called again to continue the operation from where the error occurred.
-
-