On 14/05/2013 20:32, Xueming Shen wrote:
It has been discussed before that the IOE is preferred in case of the
wrapped
decoding stream. The spec of wrap() does mention that "IOE when reading
bytes that can not be decoded".
So personally I feel it has been "covered", but if preferred, it can
go further as
"If there is padding character present in the final unit, the correct
number of padding
character(s) must be present, otherwise IllegalArgumentException (or
IOException in case
of decoding from the wrapped base64 stream), is thrown during decoding."?
-Sherman
Right, this has come up before. The intention is that IAE be thrown if
the array/buffer provided as an argument is invalid, meaning containing
bytes that cannot be decoded. For the wrap methods then there aren't any
invalid arguments, instead it is bytes read from the stream that can't
be decoded. I believe we agreed here to keep this consistent with other
InputStream usages where malformed data or decoding causes IOException
to be thrown. If there is any doubt then it would be good to clarify
this, maybe "IOException when reading from a a base64 stream".
-Alan.