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()`
  Default constructor for HlsClearKeyCache.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract boolean`
  `containsUri(Uri uri)`
  Checks if a URI is present in the cache.
  `abstract byte[]`
  `get(Uri uri)`
  Returns the encryption key cached against the given URI.
  `abstract byte[]`
  `put(Uri uri, byte[] encryptionKey)`
  Inserts an entry into the cache.
  `abstract byte[]`
  `remove(Uri uri)`
  Removes a 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()
    Default constructor for HlsClearKeyCache.

- ## Method Details

  - ### get

    @Nullable public abstract byte[] get(@Nullable Uri uri)
    Returns the encryption key cached against the given URI.
    Parameters:
      `uri` - The URI to look up in the cache
    Returns:
      The cached encryption key, or null if the URI is not in the cache

  - ### put

    @Nullable public abstract byte[] put(@NonNull Uri uri, @NonNull byte[] encryptionKey)
    Inserts an entry into the cache.
    Parameters:
      `uri` - The URI to cache the encryption key against
      `encryptionKey` - The encryption key to cache
    Returns:
      The previous encryption key associated with the URI, or null if there was none
    Throws:
      `NullPointerException` - if uri or encryptionKey are null

  - ### containsUri

    public abstract boolean containsUri(@NonNull Uri uri)
    Checks if a URI is present in the cache.
    Parameters:
      `uri` - The URI to check
    Returns:
      true if the URI is present in the cache, false otherwise
    Throws:
      `NullPointerException` - if uri is null

  - ### remove

    @Nullable public abstract byte[] remove(@NonNull Uri uri)
    Removes a URI from the cache.
    Parameters:
      `uri` - The URI to remove from the cache
    Returns:
      The encryption key that was associated with the URI, or null if the URI was not in the cache
    Throws:
      `NullPointerException` - if uri is null