Package com.castlabs.android.player

# Class HlsClearKeyCache

java.lang.Object
com.castlabs.android.player.HlsClearKeyCache

Direct Known Subclasses:
  `MemoryHlsClearKeyCache`

public abstract class HlsClearKeyCache extends Object
Cache for `Drm.Clearkey`.

Can be `gotten` or `PlayerController.setHlsKeyCache(HlsClearKeyCache)` set} in the PlayerController.

See Also:
  - `MemoryHlsClearKeyCache`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `HlsClearKeyCache()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract boolean`
  `containsUri(Uri uri)`
  Returns true if `uri` is present in the cache.
  `abstract byte[]`
  `get(Uri uri)`
  Returns the `encryptionKey` cached against this `uri`, or null if `uri` is null or not present in the cache.
  `abstract byte[]`
  `put(Uri uri, byte[] encryptionKey)`
  Inserts an entry into the cache.
  `abstract byte[]`
  `remove(Uri uri)`
  Removes `uri` from the cache.

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

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

- ## Constructor Details

  - ### HlsClearKeyCache

    public HlsClearKeyCache()

- ## Method Details

  - ### get

    @Nullable public abstract byte[] get(@Nullable Uri uri)
    Returns the `encryptionKey` cached against this `uri`, or null if `uri` is null or not present in the cache.

  - ### put

    @Nullable public abstract byte[] put(@NonNull Uri uri, @NonNull byte[] encryptionKey)
    Inserts an entry into the cache.
    Throws:
      `NullPointerException` - if `uri` or `encryptionKey` are null.

  - ### containsUri

    public abstract boolean containsUri(@NonNull Uri uri)
    Returns true if `uri` is present in the cache.
    Throws:
      `NullPointerException` - if `uri` is null.

  - ### remove

    @Nullable public abstract byte[] remove(@NonNull Uri uri)
    Removes `uri` from the cache. If `uri` was present in the cahce, this returns the corresponding `encryptionKey`, otherwise null.
    Throws:
      `NullPointerException` - if `uri` is null.