public class ExceptionCatchingInputStream extends InputStream
InputStream
that catches IOException
s 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 InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
public void mark(int readlimit)
mark
in class InputStream
public boolean markSupported()
markSupported
in class InputStream
public int read(byte[] buffer) throws IOException
read
in class InputStream
IOException
public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException
read
in class InputStream
IOException
public void reset() throws IOException
reset
in class InputStream
IOException
public long skip(long byteCount) throws IOException
skip
in class InputStream
IOException
public int read() throws IOException
read
in class InputStream
IOException
public IOException getException()
public void release()