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

ChannelAsInput.readFully(ByteBuffer) throws IllegalArgumentException: Not enough bytes available (0) to read 128 bytes #94

Closed
rgoldberg opened this issue Mar 4, 2020 · 1 comment

Comments

@rgoldberg
Copy link

rgoldberg commented Mar 4, 2020

In 0.1.16, ChannelAsInput.readFully(ByteBuffer) throws an IllegalArgumentException: Not enough bytes available (0) to read 128 bytes, when a similar call using a ByteArray instead of a ByteBuffer works fine.

e.g.:

fun test(sbc: SeekableByteChannel) {
	val LENGTH = 128
	sbc.position(sbc.size() - LENGTH)
	sbc.asInput().readFully(ByteBuffer.allocateDirect(LENGTH)) // throws exception
//	sbc.asInput().readFully(ByteArray(LENGTH), 0, LENGTH)      // substituting this line for the one above works without exception
}

Using:

kotlinx-io: 0.1.16
kotlin: 1.3.70
java: AdoptOpenJDK (build 13.0.2+8)
gradle: 6.2.1
macOS: 10.15.3

@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