Hi,

I'm pretty new to MINA as well as Java NIO. So my question might be very
stupid. I'm trying to write a new protocol codec which is basically pretty
much like the TextLineCodec. I see that I need to iterate through the
IoBuffer 'in' until I find an expected end-of-package byte. I would like to
know which one below yields a better performance or they are the same:

1. While I iterate through IoBuffer 'in' (byte b = in.get();), I put the
byte 'b' to my buffer, say 'temp'. When I found the end-of-package byte, I
use ProtocolDecoderOutput out.write(temp.flip());

or

2. When the end-of-package byte is found, set a proper limit/position of
'in', then use temp.put(in) and out.write(temp.flip()). This way is like
TextLineDecoder does.

Thank you in advance,
NB

Reply via email to