RFR 8139206: Add InputStream readNBytes(int len)
Brian Burkhalter
brian.burkhalter at oracle.com
Mon Jan 22 15:51:50 UTC 2018
On Jan 22, 2018, at 7:05 AM, Weijun Wang <weijun.wang at oracle.com> wrote:
>> Both methods that throw and not throw have been proposed. But adding two methods
>> seems like to too much clutter in the API and the methods appear too similar.
>
> Sorry I wasn't aware of earlier discussions on this. My feeling is that readNBytesFully() is more useful than readNBytesAtMost().
There was also a proposal to add a single method
byte[] readNBytes(int len, boolean exact)
which would read at most ‘len’ bytes but would throw an IOE if the length of the returned array were less than ‘len’ and ‘exact’ were true. This was rejected as being too confusing.
Brian
More information about the core-libs-dev
mailing list