Commit 8e67837a by mansfieldmark Committed by Oliver Woodman

Adding conservative @Nullable annotations to Exoplayer v2 Cache + CacheSpan

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165715928
parent a1add8f9
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
package com.google.android.exoplayer2.upstream.cache; package com.google.android.exoplayer2.upstream.cache;
import android.support.annotation.Nullable;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.NavigableSet; import java.util.NavigableSet;
...@@ -104,7 +105,7 @@ public interface Cache { ...@@ -104,7 +105,7 @@ public interface Cache {
* @param key The key for which spans should be returned. * @param key The key for which spans should be returned.
* @return The spans for the key. May be null if there are no such spans. * @return The spans for the key. May be null if there are no such spans.
*/ */
NavigableSet<CacheSpan> getCachedSpans(String key); @Nullable NavigableSet<CacheSpan> getCachedSpans(String key);
/** /**
* Returns all keys in the cache. * Returns all keys in the cache.
...@@ -151,7 +152,7 @@ public interface Cache { ...@@ -151,7 +152,7 @@ public interface Cache {
* @param position The position of the data being requested. * @param position The position of the data being requested.
* @return The {@link CacheSpan}. Or null if the cache entry is locked. * @return The {@link CacheSpan}. Or null if the cache entry is locked.
*/ */
CacheSpan startReadWriteNonBlocking(String key, long position) throws CacheException; @Nullable CacheSpan startReadWriteNonBlocking(String key, long position) throws CacheException;
/** /**
* Obtains a cache file into which data can be written. Must only be called when holding a * Obtains a cache file into which data can be written. Must only be called when holding a
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package com.google.android.exoplayer2.upstream.cache; package com.google.android.exoplayer2.upstream.cache;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import java.io.File; import java.io.File;
...@@ -43,7 +44,7 @@ public class CacheSpan implements Comparable<CacheSpan> { ...@@ -43,7 +44,7 @@ public class CacheSpan implements Comparable<CacheSpan> {
/** /**
* The file corresponding to this {@link CacheSpan}, or null if {@link #isCached} is false. * The file corresponding to this {@link CacheSpan}, or null if {@link #isCached} is false.
*/ */
public final File file; public final @Nullable File file;
/** /**
* The last access timestamp, or {@link C#TIME_UNSET} if {@link #isCached} is false. * The last access timestamp, or {@link C#TIME_UNSET} if {@link #isCached} is false.
*/ */
...@@ -68,11 +69,12 @@ public class CacheSpan implements Comparable<CacheSpan> { ...@@ -68,11 +69,12 @@ public class CacheSpan implements Comparable<CacheSpan> {
* @param position The position of the {@link CacheSpan} in the original stream. * @param position The position of the {@link CacheSpan} in the original stream.
* @param length The length of the {@link CacheSpan}, or {@link C#LENGTH_UNSET} if this is an * @param length The length of the {@link CacheSpan}, or {@link C#LENGTH_UNSET} if this is an
* open-ended hole. * open-ended hole.
* @param lastAccessTimestamp The last access timestamp, or {@link C#TIME_UNSET} if * @param lastAccessTimestamp The last access timestamp, or {@link C#TIME_UNSET} if {@link
* {@link #isCached} is false. * #isCached} is false.
* @param file The file corresponding to this {@link CacheSpan}, or null if it's a hole. * @param file The file corresponding to this {@link CacheSpan}, or null if it's a hole.
*/ */
public CacheSpan(String key, long position, long length, long lastAccessTimestamp, File file) { public CacheSpan(
String key, long position, long length, long lastAccessTimestamp, @Nullable File file) {
this.key = key; this.key = key;
this.position = position; this.position = position;
this.length = length; this.length = length;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment