From 5f4d6506e0918405324dea20664a64485208ebe4 Mon Sep 17 00:00:00 2001 From: eguven Date: Fri, 13 Jan 2017 04:46:18 -0800 Subject: [PATCH] Add argument checks and some javadoc to CachedContentIndex ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=144430372 --- .../upstream/cache/CachedContentIndex.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java b/library/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java index 2ec4099e01..58cc70d68d 100644 --- a/library/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java +++ b/library/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java @@ -67,14 +67,25 @@ import javax.crypto.spec.SecretKeySpec; private boolean changed; private ReusableBufferedOutputStream bufferedOutputStream; - /** Creates a CachedContentIndex which works on the index file in the given cacheDir. */ + /** + * Creates a CachedContentIndex which works on the index file in the given cacheDir. + * + * @param cacheDir Directory where the index file is kept. + */ public CachedContentIndex(File cacheDir) { this(cacheDir, null); } - /** Creates a CachedContentIndex which works on the index file in the given cacheDir. */ + /** + * Creates a CachedContentIndex which works on the index file in the given cacheDir. + * + * @param cacheDir Directory where the index file is kept. + * @param secretKey If not null, cache keys will be stored encrypted on filesystem using AES/CBC. + * The key must be 16 bytes long. + */ public CachedContentIndex(File cacheDir, byte[] secretKey) { if (secretKey != null) { + Assertions.checkArgument(secretKey.length == 16); try { cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING"); secretKeySpec = new SecretKeySpec(secretKey, "AES");