JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.24k stars 1.11k forks source link

[resources] Read exactly requested count of bytes from InputStream on jvm platforms. #4943

Closed terrakok closed 2 weeks ago

terrakok commented 2 weeks ago

In some cases the skip and read methods may handle less bytes then expected. The PR fixes it by proper API on the JVM and manual check on the Android.

Fixes https://github.com/JetBrains/compose-multiplatform/issues/4938

Testing

I manually checked it on the project from the issue.

Release Notes

Fixes - Resources

AChep commented 2 weeks ago

You should check for the end of a file in the Android implementation. Currently if you request to read N bytes, but there are less than that it will get stuck in the loop.

AChep commented 2 weeks ago

The changes in other Compose files are also probably not needed 😃