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) |
@NonNull public static ExceptionCatchingInputStream obtain(@NonNull 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)
read in class InputStreampublic int read(byte[] buffer,
int byteOffset,
int byteCount)
read in class InputStreampublic void reset()
throws IOException
reset in class InputStreamIOExceptionpublic long skip(long byteCount)
skip in class InputStreampublic int read()
read in class InputStream@Nullable public IOException getException()
public void release()