Package com.castlabs.android.player
Class MemoryHlsClearKeyCache
- java.lang.Object
-
- com.castlabs.android.player.HlsClearKeyCache
-
- com.castlabs.android.player.MemoryHlsClearKeyCache
-
- All Implemented Interfaces:
Parcelable
public class MemoryHlsClearKeyCache extends HlsClearKeyCache implements Parcelable
Cache forDrm.Clearkeywhich stores keys in memory.Can be
gottenorPlayerController.setHlsKeyCache(HlsClearKeyCache)set} in the PlayerController.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description static Parcelable.Creator<MemoryHlsClearKeyCache>CREATORstatic intDEFAULT_CACHE_SIZEDefault maximum cache size-
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
-
Constructor Summary
Constructors Constructor Description MemoryHlsClearKeyCache()Create an empty cache with a size ofDEFAULT_CACHE_SIZEMemoryHlsClearKeyCache(int maxCacheSize, Map<Uri,byte[]> cache)Creates a cache with a size of maxCacheSize and pre-filled with the provided Map.MemoryHlsClearKeyCache(Map<Uri,byte[]> cache)Create a cache with a size ofDEFAULT_CACHE_SIZEand pre-filled with the provided Map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsUri(Uri uri)Returns true ifuriis present in the cache.intdescribeContents()byte[]get(Uri uri)Returns theencryptionKeycached against thisuri, or null ifuriis null or not present in the cache.byte[]put(Uri uri, byte[] encryptionKey)Inserts an entry into the cache.byte[]remove(Uri uri)Removesurifrom the cache.voidwriteToParcel(Parcel dest, int flags)
-
-
-
Field Detail
-
DEFAULT_CACHE_SIZE
public static final int DEFAULT_CACHE_SIZE
Default maximum cache size- See Also:
- Constant Field Values
-
CREATOR
public static final Parcelable.Creator<MemoryHlsClearKeyCache> CREATOR
-
-
Constructor Detail
-
MemoryHlsClearKeyCache
public MemoryHlsClearKeyCache()
Create an empty cache with a size ofDEFAULT_CACHE_SIZE
-
MemoryHlsClearKeyCache
public MemoryHlsClearKeyCache(@Nullable Map<Uri,byte[]> cache)Create a cache with a size ofDEFAULT_CACHE_SIZEand pre-filled with the provided Map.- Parameters:
cache- Existing entries to pre-fill the cache with
-
-
Method Detail
-
writeToParcel
public void writeToParcel(Parcel dest, int flags)
- Specified by:
writeToParcelin interfaceParcelable
-
describeContents
public int describeContents()
- Specified by:
describeContentsin interfaceParcelable
-
get
@Nullable public byte[] get(@Nullable Uri uri)Description copied from class:HlsClearKeyCacheReturns theencryptionKeycached against thisuri, or null ifuriis null or not present in the cache.- Specified by:
getin classHlsClearKeyCache
-
put
@Nullable public byte[] put(@NonNull Uri uri, @NonNull byte[] encryptionKey)Description copied from class:HlsClearKeyCacheInserts an entry into the cache.- Specified by:
putin classHlsClearKeyCache
-
containsUri
public boolean containsUri(@NonNull Uri uri)Description copied from class:HlsClearKeyCacheReturns true ifuriis present in the cache.- Specified by:
containsUriin classHlsClearKeyCache
-
remove
@Nullable public byte[] remove(@NonNull Uri uri)Description copied from class:HlsClearKeyCacheRemovesurifrom the cache. Ifuriwas present in the cahce, this returns the correspondingencryptionKey, otherwise null.- Specified by:
removein classHlsClearKeyCache
-
-