Class CacheWriter

  • @Deprecated
    public final class CacheWriter
    extends Object
    Deprecated. 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.
    • Field Detail


        public static final int DEFAULT_BUFFER_SIZE_BYTES
        Default buffer size to be used while caching.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CacheWriter

        public CacheWriter​(CacheDataSource dataSource,
                           DataSpec dataSpec,
                           byte[] temporaryBuffer,
                           CacheWriter.ProgressListener progressListener)
        dataSource - A CacheDataSource that writes to the target cache.
        dataSpec - Defines the data to be written.
        temporaryBuffer - A temporary buffer to be used during caching, or null if the writer should instantiate its own internal temporary buffer.
        progressListener - An optional progress listener.
    • Method Detail

      • cancel

        public void cancel()
        Cancels this writer's caching operation. cache checks for cancelation frequently during execution, and throws an InterruptedIOException if it sees that the caching operation has been canceled.