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

Add support for direct ByteBufs in JdkZlibEncoder and JdkZlibDecoder #11057

Merged
merged 1 commit into from
Mar 5, 2021

Conversation

chrisvest
Copy link
Contributor

@chrisvest chrisvest commented Mar 4, 2021

Motivation:
The JDK deflate implementation added support for operating on ByteBuffers in Java 11 or so.
This means that we don't need to restrict that implementation to ByteBufs that are heap based and can expose arrays.

Modification:
Add clauses to JdkZlibEncoder and JdkZlibDecoder for handling ByteBufs that don't have arrays, but do have one nioByteBuffer.
Expand the test coverage in JdkZlibTest to include all relevant combinations of buffer types and data types.

Result:
The JdkZlibEncoder and JdkZlibDecoder should now work on basically all non-composite ByteBufs, and likely also composite ByteBufs that have exactly one component.

Based on #11058

@normanmaurer
Copy link
Member

@chrisvest could we make this two prs ?

@chrisvest
Copy link
Contributor Author

@normanmaurer If you insist? JZlib does not support working on ByteBuffers, so the two PRs would still have to be applied in sequence.

@chrisvest chrisvest changed the title Remove JZlib and make JDK Zlib codecs support direct ByteBufs Add support for direct ByteBufs in JdkZlibEncoder and JdkZlibDecoder Mar 4, 2021
@normanmaurer
Copy link
Member

@chrisvest actually I just noticed it is two commits... I guess its fine then 👍

Motivation:
The JDK deflate implementation added support for operating on ByteBuffers in Java 11 or so.
This means that we don't need to restrict that implementation to ByteBufs that are heap based and can expose arrays.

Modification:
Add clauses to JdkZlibEncoder and JdkZlibDecoder for handling ByteBufs that don't have arrays, but do have one nioByteBuffer.
Expand the test coverage in JdkZlibTest to include all relevant combinations of buffer types and data types.

Result:
The JdkZlibEncoder and JdkZlibDecoder should now work on basically all non-composite ByteBufs, and likely also composite ByteBufs that have exactly one component.
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

Successfully merging this pull request may close these issues.

None yet

2 participants