Hi all,
I need to write a codec to encode/decode a message and would not want to reinvent the wheel.
The message sent by the client connection has the following layout:
1: Header with   a fixed length of 1444 bytes.
2: Data with a variable length. The length of data is stored in the position 67 of header with 6 bytes.

What I'm thinking is to do as follows:
1: Create a class that extends CumulativeProtocolDecoder.
2: In the doDecode method  implement the following logic:

if (in.remaining() < SZ_HEADER) { return false;}
int t = sizeOfDataFromHeader(in);
if (in.remaining() < SZ_HEADER+t) { return false;}
 out.write(new Message(in));
return true;

I would like to ask two questions:
Is there anything ready so I do not have to implement anything?
If not, what I'm doing is correct or should I implement it differently?
Thanks

-
[]S José Vilmar Estácio de Souza
http://www.informal.com.br
Msn:[email protected] Skype:jvilmar
Twitter: http://www.twitter.com/jvesouza
Phone: +55 21-2555-2650 Cel: +55 21-8868-0859

Reply via email to