Added in API level 1

AutoCloseInputStream


open class AutoCloseInputStream : FileInputStream
kotlin.Any
   ↳ java.io.InputStream
   ↳ java.io.FileInputStream
   ↳ android.os.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.

Summary

Public constructors

Public methods
open Unit

open Int

open Int

open Int
read(b: ByteArray!, off: Int, len: Int)

Inherited functions

Public constructors

AutoCloseInputStream

Added in API level 1
AutoCloseInputStream(pfd: ParcelFileDescriptor!)

Public methods

close

Added in API level 1
open fun close(): Unit
Exceptions
java.lang.Exception if this resource cannot be closed
java.io.IOException if an I/O error occurs.

read

Added in API level 1
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

Added in API level 1
open fun read(b: ByteArray!): Int
Parameters
b ByteArray!: 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.

read

Added in API level 1
open fun read(
    b: ByteArray!,
    off: Int,
    len: Int
): Int
Parameters
b ByteArray!: the buffer into which the data is read.
off Int: the start offset in the destination array b
len Int: 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