open class AutoCloseInputStream : ParcelFileDescriptor.AutoCloseInputStream
An InputStream you can create on a ParcelFileDescriptor, which will take care of calling android.os.ParcelFileDescriptor#close for you when the stream is closed. It has a ParcelFileDescriptor.AutoCloseInputStream member to make delegate calls and during definition it will create seekable or non seekable child object AssetFileDescriptor.AutoCloseInputStream depends on the type of file descriptor to provide different solution.
Summary
Public constructors
Public methods
available
open fun available(): Int
Return |
Int |
an estimate of the number of remaining bytes that can be read (or skipped over) from this input stream without blocking. |
Exceptions |
java.io.IOException |
if this file input stream has been closed by calling close or an I/O error occurs. |
close
open fun close(): Unit
Exceptions |
java.lang.Exception |
if this resource cannot be closed |
java.io.IOException |
if an I/O error occurs. |
getChannel
open fun getChannel(): FileChannel!
Return |
FileChannel! |
the file channel associated with this file input stream |
mark
open fun mark(readlimit: Int): Unit
Parameters |
readlimit |
Int: the maximum limit of bytes that can be read before the mark position becomes invalid. |
markSupported
open fun markSupported(): Boolean
Return |
Boolean |
true if this stream instance supports the mark and reset methods; false otherwise. |
read
open fun read(): Int
Return |
Int |
the next byte of data, or -1 if the end of the file is reached. |
Exceptions |
java.io.IOException |
if an I/O error occurs. |
read
open fun read(
buffer: ByteArray!,
offset: Int,
count: Int
): Int
Parameters |
b |
the buffer into which the data is read. |
off |
the start offset in the destination array b |
len |
the maximum number of bytes read. |
Return |
Int |
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached. |
Exceptions |
java.io.IOException |
if an I/O error occurs. |
java.lang.NullPointerException |
If b is null . |
java.lang.IndexOutOfBoundsException |
If off is negative, len is negative, or len is greater than b.length - off |
read
open fun read(buffer: ByteArray!): Int
Parameters |
b |
the buffer into which the data is read. |
Return |
Int |
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached. |
Exceptions |
java.io.IOException |
if an I/O error occurs. |
java.lang.NullPointerException |
if b is null . |
reset
open fun reset(): Unit
Exceptions |
java.io.IOException |
if this stream has not been marked or if the mark has been invalidated. |
skip
open fun skip(count: Long): Long
Parameters |
n |
the number of bytes to be skipped. |
Return |
Long |
the actual number of bytes skipped. |
Exceptions |
java.io.IOException |
if n is negative, if the stream does not support seek, or if an I/O error occurs. |