Back to Exoplayer

DownloadBuilder (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/testutil/DownloadBuilder.html

latest7.9 KB
Original Source

Package com.google.android.exoplayer2.testutil

Class DownloadBuilder


public final classDownloadBuilderextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

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](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")id)

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

- 

DownloadBuilder

public DownloadBuilder​([DownloadRequest](../offline/DownloadRequest.html "class in com.google.android.exoplayer2.offline")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](DownloadBuilder.html "class in com.google.android.exoplayer2.testutil")setUri​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")uri)

See Also:DownloadRequest.uri

- 

setUri

@CanIgnoreReturnValue
public[DownloadBuilder](DownloadBuilder.html "class in com.google.android.exoplayer2.testutil")setUri​([Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")uri)

See Also:DownloadRequest.uri

- 

setMimeType

@CanIgnoreReturnValue
public[DownloadBuilder](DownloadBuilder.html "class in com.google.android.exoplayer2.testutil")setMimeType​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType)

See Also:DownloadRequest.mimeType

- 

setKeySetId

@CanIgnoreReturnValue
public[DownloadBuilder](DownloadBuilder.html "class in com.google.android.exoplayer2.testutil")setKeySetId​(byte[] keySetId)

See Also:DownloadRequest.keySetId

- 

setCacheKey

@CanIgnoreReturnValue
public[DownloadBuilder](DownloadBuilder.html "class in com.google.android.exoplayer2.testutil")setCacheKey​(@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")cacheKey)

See Also:DownloadRequest.customCacheKey

- 

setState

@CanIgnoreReturnValue
public[DownloadBuilder](DownloadBuilder.html "class in com.google.android.exoplayer2.testutil")setState​([@State](../offline/Download.State.html "annotation in com.google.android.exoplayer2.offline")@com.google.android.exoplayer2.offline.Download.State int state)

See Also:Download.state

- 

setPercentDownloaded

@CanIgnoreReturnValue
public[DownloadBuilder](DownloadBuilder.html "class in com.google.android.exoplayer2.testutil")setPercentDownloaded​(float percentDownloaded)

See Also:DownloadProgress.percentDownloaded

- 

setBytesDownloaded

@CanIgnoreReturnValue
public[DownloadBuilder](DownloadBuilder.html "class in com.google.android.exoplayer2.testutil")setBytesDownloaded​(long bytesDownloaded)

See Also:DownloadProgress.bytesDownloaded

- 

setContentLength

@CanIgnoreReturnValue
public[DownloadBuilder](DownloadBuilder.html "class in com.google.android.exoplayer2.testutil")setContentLength​(long contentLength)

See Also:Download.contentLength

- 

setFailureReason

@CanIgnoreReturnValue
public[DownloadBuilder](DownloadBuilder.html "class in com.google.android.exoplayer2.testutil")setFailureReason​(int failureReason)

See Also:Download.failureReason

- 

setStopReason

@CanIgnoreReturnValue
public[DownloadBuilder](DownloadBuilder.html "class in com.google.android.exoplayer2.testutil")setStopReason​(int stopReason)

See Also:Download.stopReason

- 

setStartTimeMs

@CanIgnoreReturnValue
public[DownloadBuilder](DownloadBuilder.html "class in com.google.android.exoplayer2.testutil")setStartTimeMs​(long startTimeMs)

See Also:Download.startTimeMs

- 

setUpdateTimeMs

@CanIgnoreReturnValue
public[DownloadBuilder](DownloadBuilder.html "class in com.google.android.exoplayer2.testutil")setUpdateTimeMs​(long updateTimeMs)

See Also:Download.updateTimeMs

- 

setStreamKeys

@CanIgnoreReturnValue
public[DownloadBuilder](DownloadBuilder.html "class in com.google.android.exoplayer2.testutil")setStreamKeys​([StreamKey](../offline/StreamKey.html "class in com.google.android.exoplayer2.offline")... streamKeys)

See Also:DownloadRequest.streamKeys

- 

setCustomMetadata

@CanIgnoreReturnValue
public[DownloadBuilder](DownloadBuilder.html "class in com.google.android.exoplayer2.testutil")setCustomMetadata​(byte[] customMetadata)

See Also:DownloadRequest.data

- 

build

public[Download](../offline/Download.html "class in com.google.android.exoplayer2.offline")build()