Inverse of the LengthFieldBasedFrameDecoder

John D. Mitchell jdmitchell at gmail.com
Sat Sep 3 10:31:15 EDT 2011


On Sep 3, 2011, at 03:27 , peter.jb.ball wrote:

> Is there an encoder that does the inverse of the
> LengthFieldBasedFrameDecoder?
> 
> I know its not a complicated piece of code by I have found myself writing
> code to achieve this more than once and, as such, it would be nice if
> something existing as part of the framework, perhaps called the
> LengthFieldBasedFrameEncoder ;-)

I'm confused... you want something to write the length of the message and then the message?  Or are you really asking about a more general message construction system or even a full-blown messaging system?

A lot of the complexity of LengthFieldBasedFrameDecoder is for dealing with so many complicated, existing formats but that's no particular reason to try and recreate that complexity if you're writing new protocols. For these cases, I suggest at least checking out DJB's 'netstring' format and the public expansion of that spearheaded by Zed and his 'tnetstring' format:
http://tnetstrings.org/

Hope this helps,
John




More information about the netty-users mailing list