Package com.bumptech.glide.util
Class ExceptionPassthroughInputStream
java.lang.Object
java.io.InputStream
com.bumptech.glide.util.ExceptionPassthroughInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
An
InputStream that catches, stores and rethrows IOExceptions
during read and skip calls. This allows users of this API to handle the exception at a higher
level if the exception is swallowed by some intermediate library. This class is a workaround for
a framework issue where exceptions during reads while decoding bitmaps in BitmapFactory can return partially decoded bitmaps.
Unlike the deprecated ExceptionCatchingInputStream, this class will both store and
re-throw any IOExceptions. Rethrowing works around bugs in wrapping streams that may not fully
obey the stream contract. This is really only useful if some middle layer is going to catch the
exception (like BitmapFactory) but we want to propagate the exception instead.
See https://github.com/bumptech/glide/issues/126 and #4438.
-
Method Summary
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Method Details
-
obtain
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
mark
public void mark(int readLimit) - Overrides:
markin classInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
getException
-
release
public void release()
-