|Modifier and Type||Class and Description|
Thrown when an
|Constructor and Description|
|Modifier and Type||Method and Description|
When the source is open, returns the URI from which data is being read.
Reads up to
public ContentDataSource(Context context)
public long open(DataSpec dataSpec) throws ContentDataSource.ContentDataSourceException
DataSourceto read the specified data. Calls to
DataSource.close()must be balanced.
DataSource.open(DataSpec) throws an
IOException, callers must still call
DataSource.close() to ensure that any partial effects of the
are cleaned up. Implementations of this class can assume that callers will call
DataSource.close() in this case.
dataSpec- Defines the data to be read.
C.LENGTH_UNBOUNDED) this value is the resolved length of the request, or
C.LENGTH_UNBOUNDEDif the length is still unresolved. For all other requests, the value returned will be equal to the request's
public int read(byte buffer, int offset, int readLength) throws ContentDataSource.ContentDataSourceException
lengthbytes of data and stores them into
buffer, starting at index
This method blocks until at least one byte of data can be read, the end of the opened range is detected, or an exception is thrown.
buffer- The buffer into which the read data should be stored.
offset- The start offset into
bufferat which data should be written.
readLength- The maximum number of bytes to read.
C.RESULT_END_OF_INPUTif the end of the opened range is reached.
public String getUri()
If redirection occurred, the URI after redirection is the one returned.
public void close() throws ContentDataSource.ContentDataSourceException