Apache camel netty tcp 组件文档(http://camel.apache.org/netty.html)说,
编码器
A custom ChannelHandler class that can be used to perform special marshalling of outbound payloads. Must override org.jboss.netty.channel.ChannelDownStreamHandler.
解码器
A custom ChannelHandler class that can be used to perform special marshalling of inbound payloads. Must override org.jboss.netty.channel.ChannelUpStreamHandler.
能否请您举例说明在重写类中如何/做什么。我想要一个自定义的 tcp 编码器/解码器来读取/写入字节。
最佳答案
这个类和它的父类(super class)都是编码器,你可以用它作为例子:org.jboss.netty.handler.codec.string.StringEncoder
netty 页面上“使用多个编解码器”标题中的示例中还使用了其他类,您可以查看源代码以了解它们如何使用接口(interface)。
如果失败,最好查看 netty 项目并查看编码器的单元测试。
关于java - Apache camel netty 自定义编码器和解码器示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33372438/