Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readByteArray is broken #107

Closed
altavir opened this issue Mar 31, 2020 · 2 comments
Closed

readByteArray is broken #107

altavir opened this issue Mar 31, 2020 · 2 comments

Comments

@altavir
Copy link

altavir commented Mar 31, 2020

var position = size
while (position < size) {

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

@altavir
Copy link
Author

altavir commented Apr 5, 2020

Even after my fix, the method is still broken. By contract, this method:

val count = readBufferRange { buffer, startOffset, endOffset ->
val length = min(endOffset - startOffset, size - position)
buffer.copyTo(result, startOffset, length, position)
length
}

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 altavir mentioned this issue Apr 6, 2020
@fzhinkin
Copy link
Collaborator

We're rebooting the kotlinx-io development (see #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants