kotlinx-io icon indicating copy to clipboard operation
kotlinx-io copied to clipboard

readByteArray is broken

Open altavir opened this issue 5 years ago • 1 comments

https://github.com/Kotlin/kotlinx-io/blob/2b54f00af7346ed9ff52213b33821e2d588ea3e4/core/commonMain/src/kotlinx/io/InputOperations.kt#L64-L65

This two statements together mean that returned array is always empty and pointer not advanced. I recommend adding tests for that.

altavir avatar Mar 31 '20 15:03 altavir

Even after my fix, the method is still broken. By contract, this method: https://github.com/Kotlin/kotlinx-io/blob/fe899e0e2cbef86cbf7354f7fd774807b341cf34/core/commonMain/src/kotlinx/io/InputOperations.kt#L66-L71 should return the position after read (I don't know how it meant to know the position - it is private), but returns the number of bytes being read, so it works only when we are reading at the beginning of new buffer. Any suggestions?

altavir avatar Apr 05 '20 18:04 altavir

We're rebooting the kotlinx-io development (see https://github.com/Kotlin/kotlinx-io/issues/131), all issues related to the previous versions will be closed. Consider reopening it if the issue remains (or the feature is still missing) in a new version.

fzhinkin avatar Jun 12 '23 11:06 fzhinkin