Review/comment needed for the new public java.util.Base64 class

Alan Bateman Alan.Bateman at oracle.com
Fri Oct 12 20:16:14 UTC 2012


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



More information about the core-libs-dev mailing list