Class CacheWriter


  • public final class CacheWriter
    extends Object
    Caching related utility methods.
    • Field Detail

      • DEFAULT_BUFFER_SIZE_BYTES

        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,
                           @Nullable
                           byte[] temporaryBuffer,
                           @Nullable
                           CacheWriter.ProgressListener progressListener)
        Parameters:
        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.