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 for `Drm.Clearkey` which stores keys in memory.

  Can be `gotten` or `PlayerController.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>` | `CREATOR` |
    `static int` | `DEFAULT_CACHE_SIZE` | Default 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 of `DEFAULT_CACHE_SIZE`
    `MemoryHlsClearKeyCache​(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 of `DEFAULT_CACHE_SIZE` and pre-filled with the provided Map.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `containsUri​(Uri uri)` | Returns true if `uri` is present in the cache.
    `int` | `describeContents()` |
    `byte[]` | `get​(Uri uri)` | Returns the `encryptionKey` cached against this `uri`, or null if `uri` is null or not present in the cache.
    `byte[]` | `put​(Uri uri, byte[] encryptionKey)` | Inserts an entry into the cache.
    `byte[]` | `remove​(Uri uri)` | Removes `uri` from the cache.
    `void` | `writeToParcel​(Parcel dest, int flags)` |

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 of `DEFAULT_CACHE_SIZE`

    - #### MemoryHlsClearKeyCache

          public MemoryHlsClearKeyCache​(@Nullable
                                        Map<Uri,​byte[]> cache)

      Create a cache with a size of `DEFAULT_CACHE_SIZE` and pre-filled with the provided Map.
      Parameters:
        `cache` - Existing entries to pre-fill the cache with

    - #### MemoryHlsClearKeyCache

          public MemoryHlsClearKeyCache​(int maxCacheSize,
                                        @Nullable
                                        Map<Uri,​byte[]> cache)

      Creates a cache with a size of maxCacheSize and pre-filled with the provided Map.
      Parameters:
        `maxCacheSize` - Maximum size of the cache
        `cache` - Existing entries to pre-fill the cache with

  - ### Method Detail

    - #### writeToParcel

          public void writeToParcel​(Parcel dest,
                                    int flags)

      Specified by:
        `writeToParcel` in interface `Parcelable`

    - #### describeContents

          public int describeContents()

      Specified by:
        `describeContents` in interface `Parcelable`

    - #### get

          @Nullable
          public byte[] get​(@Nullable
                            Uri uri)

      Description copied from class: `HlsClearKeyCache`
      Returns the `encryptionKey` cached against this `uri`, or null if `uri` is null or not present in the cache.
      Specified by:
        `get` in class `HlsClearKeyCache`

    - #### put

          @Nullable
          public byte[] put​(@NonNull
                            Uri uri,
                            @NonNull
                            byte[] encryptionKey)

      Description copied from class: `HlsClearKeyCache`
      Inserts an entry into the cache.
      Specified by:
        `put` in class `HlsClearKeyCache`

    - #### containsUri

          public boolean containsUri​(@NonNull
                                     Uri uri)

      Description copied from class: `HlsClearKeyCache`
      Returns true if `uri` is present in the cache.
      Specified by:
        `containsUri` in class `HlsClearKeyCache`

    - #### remove

          @Nullable
          public byte[] remove​(@NonNull
                               Uri uri)

      Description copied from class: `HlsClearKeyCache`
      Removes `uri` from the cache. If `uri` was present in the cahce, this returns the corresponding `encryptionKey`, otherwise null.
      Specified by:
        `remove` in class `HlsClearKeyCache`