public final class DataSpec extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
DataSpec.Flags
The flags that apply to any request for data.
|
Modifier and Type | Field and Description |
---|---|
long |
absoluteStreamPosition
The absolute position of the data in the full stream.
|
static int |
FLAG_ALLOW_GZIP
Permits an underlying network stack to request that the server use gzip compression.
|
int |
flags
Request flags.
|
String |
key
A key that uniquely identifies the original stream.
|
long |
length
The length of the data, or
C.LENGTH_UNSET . |
long |
position
The position of the data when read from
uri . |
byte[] |
postBody
Body for a POST request, null otherwise.
|
Uri |
uri
The source from which data should be read.
|
Constructor and Description |
---|
DataSpec(Uri uri)
|
DataSpec(Uri uri,
byte[] postBody,
long absoluteStreamPosition,
long position,
long length,
String key,
int flags)
|
DataSpec(Uri uri,
int flags)
|
DataSpec(Uri uri,
long absoluteStreamPosition,
long position,
long length,
String key,
int flags)
|
DataSpec(Uri uri,
long absoluteStreamPosition,
long length,
String key)
|
DataSpec(Uri uri,
long absoluteStreamPosition,
long length,
String key,
int flags)
|
public static final int FLAG_ALLOW_GZIP
Should not typically be set if the data being requested is already compressed (e.g. most audio and video requests). May be set when requesting other data.
When a DataSource
is used to request data with this flag set, and if the
DataSource
does make a network request, then the value returned from
DataSource.open(DataSpec)
will typically be C.LENGTH_UNSET
. The data read from
DataSource.read(byte[], int, int)
will be the decompressed data.
public final Uri uri
public final byte[] postBody
public final long absoluteStreamPosition
public final long position
uri
.
Always equal to absoluteStreamPosition
unless the uri
defines the location
of a subset of the underyling data.
public final long length
C.LENGTH_UNSET
.public final String key
DataSpec
is not intended to be used in conjunction with a cache.public final int flags
FLAG_ALLOW_GZIP
is the only supported flag.public DataSpec(Uri uri, long absoluteStreamPosition, long length, String key)
uri
- uri
.absoluteStreamPosition
- absoluteStreamPosition
, equal to position
.length
- length
.key
- key
.public DataSpec(Uri uri, long absoluteStreamPosition, long position, long length, String key, int flags)