简体   繁体   中英

Can netty codec send package while object serialization

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)?

从您的问题来看,您似乎想使用ChannelOutboundHandlerAdaptor并且只要填充缓冲区就可以在write(...)ctx.write(...)调用中ctx.write(...)分配ByteBuf。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM