question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Netty 5] Proposal: Use Deflater::deflate(ByteBuffer) in a ZlibEndcoder implementation

See original GitHub issue

Netty version

netty-all-4.1.29.Final

Expected behavior

Being able to compress ByteBufs without transferring them into a byte array.

Actual behavior

Currently ZlibEncoder encode copies ByteBuf’s content into a newly created array if the ByteBuf is not backed by a byte array. Since JDK 11 we have java.util.zip.Defalter::deflate​(ByteBuffer) which judging by the implementation does the job.

I would propose to provide an additional implementation of ZlibEncoder and ZlibDecoder (e.g. NioZlibDecoder/NioZlibEncoder) with the requirements JDK 11 or later.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ejona86commented, Jan 7, 2020

Seems this could be done within the current implementation transparently.

0reactions
kashikecommented, May 27, 2021

It looks like #11057 covered this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chapter 5. ByteBuf - Netty in Action - liveBook · Manning
Netty's alternative to ByteBuffer is ByteBuf , a powerful implementation that addresses the limitations of the JDK API and provides a better API...
Read more >
Using as a generic library - Netty.docs
nio. ByteBuffer relies on the JVM garbage collector. It works OK for heap buffers, but not direct buffers. By design, direct buffers are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found