Fix dual page split for local source (#485)

`InputStream.available()` is implementation-dependent, should never assume it will return the total number of bytes in the stream.
This commit is contained in:
FooIbar 2024-03-09 23:09:06 +08:00 committed by GitHub
parent 154f4d327c
commit d0e64d3a66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -551,7 +551,7 @@ object ImageUtil {
imageStream: InputStream, imageStream: InputStream,
resetAfterExtraction: Boolean = true, resetAfterExtraction: Boolean = true,
): BitmapFactory.Options { ): BitmapFactory.Options {
imageStream.mark(imageStream.available() + 1) imageStream.mark(Int.MAX_VALUE)
val imageBytes = imageStream.readBytes() val imageBytes = imageStream.readBytes()
val options = BitmapFactory.Options().apply { inJustDecodeBounds = true } val options = BitmapFactory.Options().apply { inJustDecodeBounds = true }