开发者

Question about Netty's Channel.write(Object) signature - Unclear documentation

开发者 https://www.devze.com 2023-02-25 12:53 出处:网络
The Netty library (written in Java) defines the following write method in the channel interface: ChannelFutu开发者_如何学编程re write(Object message)

The Netty library (written in Java) defines the following write method in the channel interface:

ChannelFutu开发者_如何学编程re write(Object message) 

However, the Javadoc does not explain how this method is going to use the provided message to extract data and send it. It is not like one could pass any object. It does not make sense.

The user guide shows a call example with a ChannelBuffer, but it does not connect the dots between the signature and the usage.

My question what is the proper use of this method? And why hasn't it been defined like this:

ChannelFuture write(ChannelBuffer message) 

Is there a special use case for 'object'? Is there any documentation about this?


I think the "Speaking POJO" section of the user guide explains it fairly well: http://docs.jboss.org/netty/3.2/guide/html/start.html#start.pojo.

Simply put, a stream or frame of bytes can be converted to Java objects upstream, and vice versa downstream.

0

精彩评论

暂无评论...
验证码 换一张
取 消