Package com.castlabs.android.player

# Class DrmKeyStorage

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

public class DrmKeyStorage extends Object
Represents a storage for DRM key information. This class handles the encoding and decoding of DRM key data, including key set ID, timing information, and flags.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final byte`
  `flags`
  Additional flags associated with the DRM key.
  `final byte[]`
  `keySetId`
  The ID of the key set.
  `final long`
  `keyValidUntilMs`
  The timestamp in milliseconds until which the key is valid.
  `final long`
  `serverToLocalOffsetMs`
  The offset in milliseconds between the server time and the local time.
  `final long`
  `syncElapsedTime`
  The elapsed time in milliseconds since the last synchronization.
  `final long`
  `syncLocalTime`
  The local time in milliseconds when the last synchronization occurred.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DrmKeyStorage(byte[] encoded)`
  Constructs a DrmKeyStorage object from an encoded byte array.
  `DrmKeyStorage(byte[] keySetId, long serverToLocalOffsetMs, long keyValidUntilMs, long syncLocalTime, long syncElapsedTime, byte flags)`
  Constructs a DrmKeyStorage object with the specified parameters.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static DrmKeyStorage`
  `createWithoutTimingInfo(byte[] keySetId)`
  Creates a DrmKeyStorage object without timing information.
  `byte[]`
  `encode()`
  Encodes the DrmKeyStorage object into a byte array.
  `String`
  `toString()`

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

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

- ## Field Details

  - ### keySetId

    public final byte[] keySetId
    The ID of the key set.

  - ### serverToLocalOffsetMs

    public final long serverToLocalOffsetMs
    The offset in milliseconds between the server time and the local time.

  - ### keyValidUntilMs

    public final long keyValidUntilMs
    The timestamp in milliseconds until which the key is valid.

  - ### syncLocalTime

    public final long syncLocalTime
    The local time in milliseconds when the last synchronization occurred.

  - ### syncElapsedTime

    public final long syncElapsedTime
    The elapsed time in milliseconds since the last synchronization.

  - ### flags

    public final byte flags
    Additional flags associated with the DRM key.

- ## Constructor Details

  - ### DrmKeyStorage

    public DrmKeyStorage(byte[] keySetId, long serverToLocalOffsetMs, long keyValidUntilMs, long syncLocalTime, long syncElapsedTime, byte flags)
    Constructs a DrmKeyStorage object with the specified parameters.
    Parameters:
      `keySetId` - The key set ID to be used in the DrmKeyStorage object.
      `serverToLocalOffsetMs` - The offset from server time to local time in milliseconds.
      `keyValidUntilMs` - The time until which the key is valid, in milliseconds.
      `syncLocalTime` - The local time when the last synchronization occurred, in milliseconds.
      `syncElapsedTime` - The elapsed time since the last synchronization, in milliseconds.
      `flags` - Additional flags for the DrmKeyStorage object.

  - ### DrmKeyStorage

    public DrmKeyStorage(byte[] encoded)
    Constructs a DrmKeyStorage object from an encoded byte array. The byte array should be in the format defined by the encode() method.
    Parameters:
      `encoded` - The byte array to decode into a DrmKeyStorage object.
    Throws:
      `IllegalArgumentException` - if the byte array does not match the expected format.

- ## Method Details

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### encode

    public byte[] encode()
    Encodes the DrmKeyStorage object into a byte array.
    Returns:
      byte array representation of the DrmKeyStorage object.

  - ### createWithoutTimingInfo

    public static DrmKeyStorage createWithoutTimingInfo(byte[] keySetId)
    Creates a DrmKeyStorage object without timing information.
    Parameters:
      `keySetId` - The key set ID to be used in the DrmKeyStorage object.
    Returns:
      A new DrmKeyStorage object with the provided keySetId and default values for timing information.