DataSourceInputStream
@UnstableApi
public final class DataSourceInputStream extends InputStream
Allows data corresponding to a given DataSpec to be read from a DataSource and consumed through an InputStream.
Summary
Public constructors |
|---|
DataSourceInputStream(DataSource dataSource, DataSpec dataSpec) |
Public methods |
|
|---|---|
long |
Returns the total number of bytes that have been read or skipped. |
void |
close() |
void |
open()Optional call to open the underlying |
int |
read() |
int |
read(byte[] buffer) |
int |
read(byte[] buffer, int offset, int length) |
Inherited methods |
||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
DataSourceInputStream
public DataSourceInputStream(DataSource dataSource, DataSpec dataSpec)
| Parameters | |
|---|---|
DataSource dataSource |
The |
DataSpec dataSpec |
The |
Public methods
open
public void open()
Optional call to open the underlying DataSource.
Calling this method does nothing if the DataSource is already open. Calling this method is optional, since the read and skip methods will automatically open the underlying DataSource if it's not open already.
| Throws | |
|---|---|
java.io.IOException |
If an error occurs opening the |