public class ExceptionCatchingInputStream
extends java.io.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() |
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.InputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
public void mark(int readLimit)
mark
in class java.io.InputStream
public boolean markSupported()
markSupported
in class java.io.InputStream
public int read(byte[] buffer)
read
in class java.io.InputStream
public int read(byte[] buffer, int byteOffset, int byteCount)
read
in class java.io.InputStream
public void reset() throws java.io.IOException
reset
in class java.io.InputStream
java.io.IOException
public long skip(long byteCount)
skip
in class java.io.InputStream
public int read()
read
in class java.io.InputStream
@Nullable public java.io.IOException getException()
public void release()