public class ExceptionCatchingInputStream
extends java.io.InputStream
InputStream that catches IOExceptions during read and skip
calls and stores them so they can later be handled or thrown. This class is a workaround for a
framework issue where exceptions during reads while decoding bitmaps in BitmapFactory can return partially decoded bitmaps.
See https://github.com/bumptech/glide/issues/126.
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
java.io.IOException |
getException() |
void |
mark(int readLimit) |
boolean |
markSupported() |
static ExceptionCatchingInputStream |
obtain(java.io.InputStream toWrap) |
int |
read() |
int |
read(byte[] buffer) |
int |
read(byte[] buffer,
int byteOffset,
int byteCount) |
void |
release() |
void |
reset() |
long |
skip(long byteCount) |
@NonNull public static ExceptionCatchingInputStream obtain(@NonNull java.io.InputStream toWrap)
public int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOExceptionpublic void mark(int readLimit)
mark in class java.io.InputStreampublic boolean markSupported()
markSupported in class java.io.InputStreampublic int read(byte[] buffer)
read in class java.io.InputStreampublic int read(byte[] buffer,
int byteOffset,
int byteCount)
read in class java.io.InputStreampublic void reset()
throws java.io.IOException
reset in class java.io.InputStreamjava.io.IOExceptionpublic long skip(long byteCount)
skip in class java.io.InputStreampublic int read()
read in class java.io.InputStream@Nullable public java.io.IOException getException()
public void release()