mirror of
https://github.com/samsonjs/media.git
synced 2026-04-13 12:35:48 +00:00
Add argument checks and some javadoc to CachedContentIndex
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=144430372
This commit is contained in:
parent
0c53a4e913
commit
5f4d6506e0
1 changed files with 13 additions and 2 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue