DataSourceUtil
@UnstableApi
class DataSourceUtil
Utility methods for DataSource.
Summary
Public functions |
|
|---|---|
java-static Unit |
closeQuietly(dataSource: DataSource?)Closes a |
java-static ByteArray<Byte>! |
readExactly(dataSource: DataSource!, length: Int)Reads |
java-static ByteArray<Byte>! |
readToEnd(dataSource: DataSource!)Reads data from the specified opened |
Public functions
closeQuietly
java-static fun closeQuietly(dataSource: DataSource?): Unit
Closes a DataSource, suppressing any IOException that may occur.
| Parameters | |
|---|---|
dataSource: DataSource? |
The |
readExactly
java-static fun readExactly(dataSource: DataSource!, length: Int): ByteArray<Byte>!
Reads length bytes from the specified opened DataSource, and returns a byte array containing the read data.
| Parameters | |
|---|---|
dataSource: DataSource! |
The source from which to read. |
length: Int |
The number of bytes to read. |
| Throws | |
|---|---|
java.io.IOException |
If an error occurs reading from the source. |
java.lang.IllegalStateException |
If the end of the source was reached before |
readToEnd
java-static fun readToEnd(dataSource: DataSource!): ByteArray<Byte>!
Reads data from the specified opened DataSource until it ends, and returns a byte array containing the read data.
| Parameters | |
|---|---|
dataSource: DataSource! |
The source from which to read. |
| Throws | |
|---|---|
java.io.IOException |
If an error occurs reading from the source. |