public final class DataSourceInputStream extends InputStream
DataSpec to be read from a DataSource and
consumed as an InputStream.| Constructor and Description |
|---|
DataSourceInputStream(DataSource dataSource,
DataSpec dataSpec) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
open()
Optional call to open the underlying
DataSource. |
int |
read() |
int |
read(byte[] buffer) |
int |
read(byte[] buffer,
int offset,
int length) |
long |
skip(long byteCount) |
available, mark, markSupported, resetpublic DataSourceInputStream(DataSource dataSource, DataSpec dataSpec)
dataSource - The DataSource from which the data should be read.dataSpec - The DataSpec defining the data to be read from dataSource.public void open()
throws IOException
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.
IOException - If an error occurs opening the DataSource.public int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] buffer)
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] buffer,
int offset,
int length)
throws IOException
read in class InputStreamIOExceptionpublic long skip(long byteCount)
throws IOException
skip in class InputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOException