Package com.castlabs.android.downloader

# Class DownloadInfo

java.lang.Object
com.castlabs.android.downloader.DownloadInfo

public class DownloadInfo extends Object
Utility class that can be used to read download.info files to limit the availability of tracks.

Since:
  3.2.0

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final int[]`
  `videoTracks`
  The original indices of the selected video tracks

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<TrackIndexOverride>`
  `getAudioTracks()`
  Returns the audio tracks as a list of `TrackIndexOverride` objects.
  `List<Track>`
  `getSideloadedTracks()`
  Returns the list of sideloaded tracks.
  `List<TrackIndexOverride>`
  `getSubtitleTracks()`
  Returns the subtitle tracks as a list of `TrackIndexOverride` objects.
  `static DownloadInfo`
  `load(String pathToManifest)`
  Takes a path to a Manifest and checks if next to the manifest file, a download info file exists.
  `static void`
  `write(String manifestPath, int[] videoTracks, Track[] audioTracks, Track[] subtitleTracks, Track[] sideloadedTracks)`
  Writes the download information to a file.

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

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

- ## Field Details

  - ### videoTracks

    @Nullable public final int[] videoTracks
    The original indices of the selected video tracks

- ## Method Details

  - ### getAudioTracks

    @Nullable public List<TrackIndexOverride> getAudioTracks()
    Returns the audio tracks as a list of `TrackIndexOverride` objects.
    Returns:
      The audio tracks, or `null` if no audio tracks are available.

  - ### getSubtitleTracks

    @Nullable public List<TrackIndexOverride> getSubtitleTracks()
    Returns the subtitle tracks as a list of `TrackIndexOverride` objects.
    Returns:
      The subtitle tracks, or `null` if no subtitle tracks are available.

  - ### getSideloadedTracks

    @Nullable public List<Track> getSideloadedTracks()
    Returns the list of sideloaded tracks.
    Returns:
      The sideloaded tracks, or `null` if no sideloaded tracks are available.

  - ### load

    @NonNull public static DownloadInfo load(String pathToManifest)
    Takes a path to a Manifest and checks if next to the manifest file, a download info file exists. If so, a the info file is loaded and returned. Otherwise, an empty download info instance is returned.
    Parameters:
      `pathToManifest` - The path to the manifest file
    Returns:
      The new info instance

  - ### write

    public static void write(String manifestPath, @Nullable int[] videoTracks, @Nullable Track[] audioTracks, @Nullable Track[] subtitleTracks, @Nullable Track[] sideloadedTracks) throws IOException
    Writes the download information to a file.
    Parameters:
      `manifestPath` - The path to the manifest file.
      `videoTracks` - The video tracks to write.
      `audioTracks` - The audio tracks to write.
      `subtitleTracks` - The subtitle tracks to write.
      `sideloadedTracks` - The sideloaded tracks to write.
    Throws:
      `IOException` - If an I/O error occurs.