On 12/10/2012 21:12, Xueming Shen wrote:
Hi,

It appears to be possible to do something like

boolean de/encode(ByteBuffer src, ByteBuffer dst);

returns true if all remaining bytes in src are en/decoded, false, the dst
is not big enough for all output bytes, the src.position() will be advanced to the position of next un-en/decoded byte, dst.position() will be updated
accordingly as well.

to avoid the en/decoder to hold an internal state.
Right, there shouldn't be any need for internal state and src.remaining() will indicate if there are any bytes in src that couldn't be encoded into dst because of insufficient space. The return value should probably be the number of bytes written to dst.

-Alan

Reply via email to