Skip to content

Commit c5bba01

Browse files
authored
More compact EOF (#111)
1 parent acdc21f commit c5bba01

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/commonMain/src/kotlinx/io/Input.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,9 @@ public abstract class Input : Closeable {
213213
* This method can use [fill] if no bytes are available in the cache. Please consider using [readAvailableTo] in
214214
* performance-critical code.
215215
*/
216-
@Suppress("NOTHING_TO_INLINE")
217-
public inline fun exhausted(): Boolean = !prefetch(1)
216+
public fun exhausted(): Boolean {
217+
return position == limit && fetchCachedOrFill() == 0
218+
}
218219

219220
/**
220221
* Checks that [size] bytes are fetched in [Input].

0 commit comments

Comments
 (0)