@UnstableApi
public final class DownloadBuilder


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.

Summary

Public constructors

Creates a download builder for "uri" and no stream keys.

Creates a download builder based on the attributes of the specified request.

Public constructors

DownloadBuilder

public DownloadBuilder(String id)

Creates a download builder for "uri" and no stream keys.

Parameters
String 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
DownloadRequest request

A DownloadRequest defining the content to download.

Public methods

build

public Download build()

setBytesDownloaded

@CanIgnoreReturnValue
public DownloadBuilder setBytesDownloaded(long bytesDownloaded)
See also
bytesDownloaded

setContentLength

@CanIgnoreReturnValue
public DownloadBuilder setContentLength(long contentLength)
See also
contentLength

setCustomMetadata

@CanIgnoreReturnValue
public DownloadBuilder setCustomMetadata(byte[] customMetadata)
See also
data

setFailureReason

@CanIgnoreReturnValue
public DownloadBuilder setFailureReason(int failureReason)
See also
failureReason

setKeySetId

@CanIgnoreReturnValue
public DownloadBuilder setKeySetId(byte[] keySetId)
See also
keySetId

setMimeType

@CanIgnoreReturnValue
public DownloadBuilder setMimeType(String mimeType)
See also
mimeType

setPercentDownloaded

@CanIgnoreReturnValue
public DownloadBuilder setPercentDownloaded(float percentDownloaded)

setStartTimeMs

@CanIgnoreReturnValue
public DownloadBuilder setStartTimeMs(long startTimeMs)
See also
startTimeMs

setState

@CanIgnoreReturnValue
public DownloadBuilder setState(@Download.State int state)
See also
state

setStopReason

@CanIgnoreReturnValue
public DownloadBuilder setStopReason(int stopReason)
See also
stopReason

setStreamKeys

@CanIgnoreReturnValue
public DownloadBuilder setStreamKeys(StreamKey[] streamKeys)
See also
streamKeys

setUpdateTimeMs

@CanIgnoreReturnValue
public DownloadBuilder setUpdateTimeMs(long updateTimeMs)
See also
updateTimeMs

setUri

@CanIgnoreReturnValue
public DownloadBuilder setUri(String uri)
See also
uri

setUri

@CanIgnoreReturnValue
public DownloadBuilder setUri(Uri uri)
See also
uri