diff --git a/components/resources/library/src/desktopMain/kotlin/org/jetbrains/compose/resources/ResourceReader.desktop.kt b/components/resources/library/src/desktopMain/kotlin/org/jetbrains/compose/resources/ResourceReader.desktop.kt index 3f9097e5206..d0be848999f 100644 --- a/components/resources/library/src/desktopMain/kotlin/org/jetbrains/compose/resources/ResourceReader.desktop.kt +++ b/components/resources/library/src/desktopMain/kotlin/org/jetbrains/compose/resources/ResourceReader.desktop.kt @@ -10,12 +10,10 @@ internal actual fun getPlatformResourceReader(): ResourceReader = object : Resou override suspend fun readPart(path: String, offset: Long, size: Long): ByteArray { val resource = getResourceAsStream(path) - val result = ByteArray(size.toInt()) - resource.use { input -> + return resource.use { input -> input.skip(offset) - input.read(result, 0, size.toInt()) + input.readNBytes(size.toInt()) } - return result } override fun getUri(path: String): String {