0

suppose I want to use netty 4.X to transfer big java object (with many container). I want to use a ByteBuf as buffer during encoder in order to optimize performance and minimize memory usage, so I have two questions before I proceed.

1- I want to use MessageToByteEncoder to complete this job, is it suitable?

2- Can we writeAndFlush ByteBuf to ChannelHandlerContext when ever buffer's capacity is reached inside encod(ChannelHandlerContext, Object, ByteBuf)?

1 Answer 1

1

From your question it looks like you would want to use ChannelOutboundHandlerAdaptor and just allocate the ByteBuf by yourself in write(...) and the call ctx.write(...) whenever you filled the buffer.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.