Package com.google.android.exoplayer2.testutil

## Class DownloadBuilder

- java.lang.Object
- - com.google.android.exoplayer2.testutil.DownloadBuilder

-     public final class DownloadBuilder
      extends Object

  Builder for `Download`.

  Defines default values for each field (except `id`) to facilitate `Download` creation for tests. Tests must avoid depending on the default values but explicitly set tested parameters during test initialization.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DownloadBuilder​(DownloadRequest request)` | Creates a download builder based on the attributes of the specified request.
    `DownloadBuilder​(String id)` | Creates a download builder for "uri" and no stream keys.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Download` | `build()` |
    `DownloadBuilder` | `setBytesDownloaded​(long bytesDownloaded)` |
    `DownloadBuilder` | `setCacheKey​(String cacheKey)` |
    `DownloadBuilder` | `setContentLength​(long contentLength)` |
    `DownloadBuilder` | `setCustomMetadata​(byte[] customMetadata)` |
    `DownloadBuilder` | `setFailureReason​(int failureReason)` |
    `DownloadBuilder` | `setKeySetId​(byte[] keySetId)` |
    `DownloadBuilder` | `setMimeType​(String mimeType)` |
    `DownloadBuilder` | `setPercentDownloaded​(float percentDownloaded)` |
    `DownloadBuilder` | `setStartTimeMs​(long startTimeMs)` |
    `DownloadBuilder` | `setState​(@com.google.android.exoplayer2.offline.Download.State int state)` |
    `DownloadBuilder` | `setStopReason​(int stopReason)` |
    `DownloadBuilder` | `setStreamKeys​(StreamKey... streamKeys)` |
    `DownloadBuilder` | `setUpdateTimeMs​(long updateTimeMs)` |
    `DownloadBuilder` | `setUri​(Uri uri)` |
    `DownloadBuilder` | `setUri​(String uri)` |

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

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

- - ### Constructor Detail

    - #### DownloadBuilder

          public DownloadBuilder​(String id)

      Creates a download builder for "uri" and no stream keys.
      Parameters:
        `id` - The unique content identifier for the download.

    - #### DownloadBuilder

          public DownloadBuilder​(DownloadRequest request)

      Creates a download builder based on the attributes of the specified request.
      Parameters:
        `request` - A `DownloadRequest` defining the content to download.

  - ### Method Detail

    - #### setUri

          @CanIgnoreReturnValue
          public DownloadBuilder setUri​(String uri)

      See Also:
        `DownloadRequest.uri`

    - #### setUri

          @CanIgnoreReturnValue
          public DownloadBuilder setUri​(Uri uri)

      See Also:
        `DownloadRequest.uri`

    - #### setMimeType

          @CanIgnoreReturnValue
          public DownloadBuilder setMimeType​(String mimeType)

      See Also:
        `DownloadRequest.mimeType`

    - #### setKeySetId

          @CanIgnoreReturnValue
          public DownloadBuilder setKeySetId​(byte[] keySetId)

      See Also:
        `DownloadRequest.keySetId`

    - #### setCacheKey

          @CanIgnoreReturnValue
          public DownloadBuilder setCacheKey​(@Nullable
                                             String cacheKey)

      See Also:
        `DownloadRequest.customCacheKey`

    - #### setState

          @CanIgnoreReturnValue
          public DownloadBuilder setState​(@State
                                          @com.google.android.exoplayer2.offline.Download.State int state)

      See Also:
        `Download.state`

    - #### setPercentDownloaded

          @CanIgnoreReturnValue
          public DownloadBuilder setPercentDownloaded​(float percentDownloaded)

      See Also:
        `DownloadProgress.percentDownloaded`

    - #### setBytesDownloaded

          @CanIgnoreReturnValue
          public DownloadBuilder setBytesDownloaded​(long bytesDownloaded)

      See Also:
        `DownloadProgress.bytesDownloaded`

    - #### setContentLength

          @CanIgnoreReturnValue
          public DownloadBuilder setContentLength​(long contentLength)

      See Also:
        `Download.contentLength`

    - #### setFailureReason

          @CanIgnoreReturnValue
          public DownloadBuilder setFailureReason​(int failureReason)

      See Also:
        `Download.failureReason`

    - #### setStopReason

          @CanIgnoreReturnValue
          public DownloadBuilder setStopReason​(int stopReason)

      See Also:
        `Download.stopReason`

    - #### setStartTimeMs

          @CanIgnoreReturnValue
          public DownloadBuilder setStartTimeMs​(long startTimeMs)

      See Also:
        `Download.startTimeMs`

    - #### setUpdateTimeMs

          @CanIgnoreReturnValue
          public DownloadBuilder setUpdateTimeMs​(long updateTimeMs)

      See Also:
        `Download.updateTimeMs`

    - #### setStreamKeys

          @CanIgnoreReturnValue
          public DownloadBuilder setStreamKeys​(StreamKey... streamKeys)

      See Also:
        `DownloadRequest.streamKeys`

    - #### setCustomMetadata

          @CanIgnoreReturnValue
          public DownloadBuilder setCustomMetadata​(byte[] customMetadata)

      See Also:
        `DownloadRequest.data`

    - #### build

          public Download build()