DataSpec.Builder
public final class DataSpec.Builder
Builds DataSpec instances.
Use DataSpec#buildUpon() to obtain a builder representing an existing DataSpec.
Summary
Public constructors |
|---|
Builder()Creates a new instance with default values. |
Public constructors
Public methods
build
public DataSpec build()
Builds a DataSpec with the builder's current values.
| Throws | |
|---|---|
java.lang.IllegalStateException |
If setUri has not been called. |
setCustomData
@CanIgnoreReturnValue
public DataSpec.Builder setCustomData(@Nullable Object customData)
Sets the customData. The default value is null.
| Parameters | |
|---|---|
@Nullable Object customData |
The |
| Returns | |
|---|---|
DataSpec.Builder |
The builder. |
setFlags
@CanIgnoreReturnValue
public DataSpec.Builder setFlags(@DataSpec.Flags int flags)
Sets the flags. The default value is 0.
| Parameters | |
|---|---|
@DataSpec.Flags int flags |
The |
| Returns | |
|---|---|
DataSpec.Builder |
The builder. |
setHttpBody
@CanIgnoreReturnValue
public DataSpec.Builder setHttpBody(@Nullable byte[] httpBody)
Sets httpBody. The default value is null.
| Returns | |
|---|---|
DataSpec.Builder |
The builder. |
setHttpMethod
@CanIgnoreReturnValue
public DataSpec.Builder setHttpMethod(@DataSpec.HttpMethod int httpMethod)
Sets httpMethod. The default value is HTTP_METHOD_GET.
| Parameters | |
|---|---|
@DataSpec.HttpMethod int httpMethod |
The |
| Returns | |
|---|---|
DataSpec.Builder |
The builder. |
setHttpRequestHeaders
@CanIgnoreReturnValue
public DataSpec.Builder setHttpRequestHeaders(Map<String, String> httpRequestHeaders)
Sets the httpRequestHeaders. The default value is an empty map.
Note: Range, Accept-Encoding and User-Agent should not be set with this method, since they are set directly by HttpDataSource implementations. See httpRequestHeaders for more details.
| Parameters | |
|---|---|
Map<String, String> httpRequestHeaders |
The |
| Returns | |
|---|---|
DataSpec.Builder |
The builder. |
setKey
@CanIgnoreReturnValue
public DataSpec.Builder setKey(@Nullable String key)
Sets the key. The default value is null.
| Returns | |
|---|---|
DataSpec.Builder |
The builder. |
setLength
@CanIgnoreReturnValue
public DataSpec.Builder setLength(long length)
Sets the length. The default value is LENGTH_UNSET.
| Parameters | |
|---|---|
long length |
The |
| Returns | |
|---|---|
DataSpec.Builder |
The builder. |
setPosition
@CanIgnoreReturnValue
public DataSpec.Builder setPosition(long position)
Sets the position. The default value is 0.
| Parameters | |
|---|---|
long position |
The |
| Returns | |
|---|---|
DataSpec.Builder |
The builder. |
setUri
@CanIgnoreReturnValue
public DataSpec.Builder setUri(String uriString)
Sets uri.
| Returns | |
|---|---|
DataSpec.Builder |
The builder. |
setUri
@CanIgnoreReturnValue
public DataSpec.Builder setUri(Uri uri)
Sets uri.
| Returns | |
|---|---|
DataSpec.Builder |
The builder. |
setUriPositionOffset
@CanIgnoreReturnValue
public DataSpec.Builder setUriPositionOffset(long uriPositionOffset)
Sets the uriPositionOffset. The default value is 0.
| Parameters | |
|---|---|
long uriPositionOffset |
The |
| Returns | |
|---|---|
DataSpec.Builder |
The builder. |