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 interface
CacheWriter.ProgressListener
Deprecated.Receives progress updates during cache operations.
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_BUFFER_SIZE_BYTES
Deprecated.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 void
cache()
Deprecated.Caches the requested data, skipping any that's already cached.void
cancel()
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
- ACacheDataSource
that writes to the target cache.dataSpec
- Defines the data to be written.temporaryBuffer
- A temporary buffer to be used during caching, ornull
if 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.cache
checks for cancelation frequently during execution, and throws anInterruptedIOException
if it sees that the caching operation has been canceled.
-
cache
@WorkerThread public void cache() throws IOException
Deprecated.Caches the requested data, skipping any that's already cached.If the
CacheDataSource
used 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.PriorityTooLowException
will be thrown if the priority required by theCacheDataSource
is 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, anInterruptedIOException
is thrown. The method may be called again to continue the operation from where the error occurred.
-
-