FrameDecoder

sohguanh sohguanh at yahoo.com.sg
Fri Sep 25 04:52:37 EDT 2009


Not wanting to flood the forum I tag along my existing topic.

TelnetClient.java Feature ?

I refer to the online sample code TelnetClient.java line 92

lastWriteFuture = channel.write(line + '\n');

Above will throw ClassCastException. Tracing through the Netty code reveal
an attempt to cast to ChannelBuffer will give a "can not fail" error.

I tweak above to below and all works fine.

lastWriteFuture = channel.write(ChannelBuffers.copiedBuffer(line + '\n',
"UTF-8");

It seems Netty is using ChannelBuffer which extends java.lang.Object to
read/write bytes to nio.

Just want to share if anyone has the same problem as me.

Thanks.
-- 
View this message in context: http://n2.nabble.com/FrameDecoder-tp3710280p3711204.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list