ExceptionPassthroughInputStream

class ExceptionPassthroughInputStream : InputStream

An java.io.InputStream that catches, stores and rethrows java.io.IOExceptions during read and skip calls. This allows users of this API to handle the exception at a higher level if the exception is swallowed by some intermediate library. This class is a workaround for a framework issue where exceptions during reads while decoding bitmaps in can return partially decoded bitmaps.

Unlike the deprecated ExceptionCatchingInputStream, this class will both store and re-throw any IOExceptions. Rethrowing works around bugs in wrapping streams that may not fully obey the stream contract. This is really only useful if some middle layer is going to catch the exception (like BitmapFactory) but we want to propagate the exception instead.

See https://github.com/bumptech/glide/issues/126 and #4438.

Functions

Link copied to clipboard
open fun available(): Int
Link copied to clipboard
open fun close()
Link copied to clipboard
open fun mark(readLimit: Int)
Link copied to clipboard
open fun markSupported(): Boolean
Link copied to clipboard
open fun nullInputStream(): InputStream
Link copied to clipboard
open fun obtain(toWrap: InputStream): ExceptionPassthroughInputStream
Link copied to clipboard
open fun read(): Int
open fun read(buffer: Array<Byte>): Int
open fun read(    buffer: Array<Byte>,     byteOffset: Int,     byteCount: Int): Int
Link copied to clipboard
open fun readAllBytes(): Array<Byte>
Link copied to clipboard
open fun readNBytes(len: Int): Array<Byte>
open fun readNBytes(    b: Array<Byte>,     off: Int,     len: Int): Int
Link copied to clipboard
open fun release()
Link copied to clipboard
open fun reset()
Link copied to clipboard
open fun skip(byteCount: Long): Long
Link copied to clipboard
open fun transferTo(out: OutputStream): Long

Properties

Link copied to clipboard
open val exception: IOException