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