public class ExceptionCatchingInputStream extends 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() |
IOException |
getException() |
void |
mark(int readlimit) |
boolean |
markSupported() |
static ExceptionCatchingInputStream |
obtain(InputStream toWrap) |
int |
read() |
int |
read(byte[] buffer) |
int |
read(byte[] buffer,
int byteOffset,
int byteCount) |
void |
release() |
void |
reset() |
long |
skip(long byteCount) |
public static ExceptionCatchingInputStream obtain(InputStream toWrap)
public int available()
throws IOException
available in class InputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionpublic void mark(int readlimit)
mark in class InputStreampublic boolean markSupported()
markSupported in class InputStreampublic int read(byte[] buffer)
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] buffer,
int byteOffset,
int byteCount)
throws IOException
read in class InputStreamIOExceptionpublic void reset()
throws IOException
reset in class InputStreamIOExceptionpublic long skip(long byteCount)
throws IOException
skip in class InputStreamIOExceptionpublic int read()
throws IOException
read in class InputStreamIOExceptionpublic IOException getException()
public void release()