public final class DataSourceInputStream
extends java.io.InputStream
DataSpec to be read from a DataSource and
consumed through an InputStream.| 构造器和说明 |
|---|
DataSourceInputStream(DataSource dataSource,
DataSpec dataSpec) |
public 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 long bytesRead()
public void open()
throws java.io.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.
java.io.IOException - If an error occurs opening the DataSource.public int read()
throws java.io.IOException
read 在类中 java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] buffer)
throws java.io.IOException
read 在类中 java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] buffer,
int offset,
int length)
throws java.io.IOException
read 在类中 java.io.InputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close 在接口中 java.io.Closeableclose 在接口中 java.lang.AutoCloseableclose 在类中 java.io.InputStreamjava.io.IOException