diff --git a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheUtil.java b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheUtil.java index ce16ea2439..9f1fc54462 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheUtil.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheUtil.java @@ -109,7 +109,6 @@ public final class CacheUtil { * * @param dataSpec Defines the data to be cached. * @param cache A {@link Cache} to store the data. - * @param cacheKeyFactory An optional factory for cache keys. * @param upstream A {@link DataSource} for reading data not in the cache. * @param progressListener A listener to receive progress updates, or {@code null}. * @param isCanceled An optional flag that will interrupt caching if set to true. @@ -120,7 +119,6 @@ public final class CacheUtil { public static void cache( DataSpec dataSpec, Cache cache, - @Nullable CacheKeyFactory cacheKeyFactory, DataSource upstream, @Nullable ProgressListener progressListener, @Nullable AtomicBoolean isCanceled) @@ -128,7 +126,7 @@ public final class CacheUtil { cache( dataSpec, cache, - cacheKeyFactory, + /* cacheKeyFactory= */ null, new CacheDataSource(cache, upstream), new byte[DEFAULT_BUFFER_SIZE_BYTES], /* priorityTaskManager= */ null, @@ -139,14 +137,14 @@ public final class CacheUtil { } /** - * Caches the data defined by {@code dataSpec} while skipping already cached data. Caching stops - * early if end of input is reached and {@code enableEOFException} is false. + * Caches the data defined by {@code dataSpec}, skipping already cached data. Caching stops early + * if end of input is reached and {@code enableEOFException} is false. * - *

If a {@link PriorityTaskManager} is given, it's used to pause and resume caching depending - * on {@code priority} and the priority of other tasks registered to the PriorityTaskManager. - * Please note that it's the responsibility of the calling code to call {@link - * PriorityTaskManager#add} to register with the manager before calling this method, and to call - * {@link PriorityTaskManager#remove} afterwards to unregister. + *

If a {@link PriorityTaskManager} is provided, it's used to pause and resume caching + * depending on {@code priority} and the priority of other tasks registered to the + * PriorityTaskManager. Please note that it's the responsibility of the calling code to call + * {@link PriorityTaskManager#add} to register with the manager before calling this method, and to + * call {@link PriorityTaskManager#remove} afterwards to unregister. * *

This method may be slow and shouldn't normally be called on the main thread. * diff --git a/library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/CacheDataSourceTest.java b/library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/CacheDataSourceTest.java index 27438fcac3..8862a65db2 100644 --- a/library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/CacheDataSourceTest.java +++ b/library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/CacheDataSourceTest.java @@ -365,7 +365,6 @@ public final class CacheDataSourceTest { CacheUtil.cache( unboundedDataSpec, cache, - /* cacheKeyFactory= */ null, upstream2, /* progressListener= */ null, /* isCanceled= */ null); @@ -414,7 +413,6 @@ public final class CacheDataSourceTest { CacheUtil.cache( unboundedDataSpec, cache, - /* cacheKeyFactory= */ null, upstream2, /* progressListener= */ null, /* isCanceled= */ null); @@ -438,7 +436,6 @@ public final class CacheDataSourceTest { CacheUtil.cache( dataSpec, cache, - /* cacheKeyFactory= */ null, upstream, /* progressListener= */ null, /* isCanceled= */ null); @@ -474,7 +471,6 @@ public final class CacheDataSourceTest { CacheUtil.cache( dataSpec, cache, - /* cacheKeyFactory= */ null, upstream, /* progressListener= */ null, /* isCanceled= */ null); diff --git a/library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/CacheUtilTest.java b/library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/CacheUtilTest.java index 9a449b2ebd..69463bff54 100644 --- a/library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/CacheUtilTest.java +++ b/library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/CacheUtilTest.java @@ -207,7 +207,6 @@ public final class CacheUtilTest { CacheUtil.cache( new DataSpec(Uri.parse("test_data")), cache, - /* cacheKeyFactory= */ null, dataSource, counters, /* isCanceled= */ null); @@ -224,8 +223,7 @@ public final class CacheUtilTest { Uri testUri = Uri.parse("test_data"); DataSpec dataSpec = new DataSpec(testUri, 10, 20, null); CachingCounters counters = new CachingCounters(); - CacheUtil.cache( - dataSpec, cache, /* cacheKeyFactory= */ null, dataSource, counters, /* isCanceled= */ null); + CacheUtil.cache(dataSpec, cache, dataSource, counters, /* isCanceled= */ null); counters.assertValues(0, 20, 20); counters.reset(); @@ -233,7 +231,6 @@ public final class CacheUtilTest { CacheUtil.cache( new DataSpec(testUri), cache, - /* cacheKeyFactory= */ null, dataSource, counters, /* isCanceled= */ null); @@ -251,8 +248,7 @@ public final class CacheUtilTest { DataSpec dataSpec = new DataSpec(Uri.parse("test_data")); CachingCounters counters = new CachingCounters(); - CacheUtil.cache( - dataSpec, cache, /* cacheKeyFactory= */ null, dataSource, counters, /* isCanceled= */ null); + CacheUtil.cache(dataSpec, cache, dataSource, counters, /* isCanceled= */ null); counters.assertValues(0, 100, 100); assertCachedData(cache, fakeDataSet); @@ -268,8 +264,7 @@ public final class CacheUtilTest { Uri testUri = Uri.parse("test_data"); DataSpec dataSpec = new DataSpec(testUri, 10, 20, null); CachingCounters counters = new CachingCounters(); - CacheUtil.cache( - dataSpec, cache, /* cacheKeyFactory= */ null, dataSource, counters, /* isCanceled= */ null); + CacheUtil.cache(dataSpec, cache, dataSource, counters, /* isCanceled= */ null); counters.assertValues(0, 20, 20); counters.reset(); @@ -277,7 +272,6 @@ public final class CacheUtilTest { CacheUtil.cache( new DataSpec(testUri), cache, - /* cacheKeyFactory= */ null, dataSource, counters, /* isCanceled= */ null); @@ -294,8 +288,7 @@ public final class CacheUtilTest { Uri testUri = Uri.parse("test_data"); DataSpec dataSpec = new DataSpec(testUri, 0, 1000, null); CachingCounters counters = new CachingCounters(); - CacheUtil.cache( - dataSpec, cache, /* cacheKeyFactory= */ null, dataSource, counters, /* isCanceled= */ null); + CacheUtil.cache(dataSpec, cache, dataSource, counters, /* isCanceled= */ null); counters.assertValues(0, 100, 1000); assertCachedData(cache, fakeDataSet); @@ -344,7 +337,6 @@ public final class CacheUtilTest { CacheUtil.cache( new DataSpec(Uri.parse("test_data")), cache, - /* cacheKeyFactory= */ null, dataSource, counters, /* isCanceled= */ null);