RFR 8193832: Performance of InputStream.readAllBytes() could be improved (original) (raw)

Peter Levart peter.levart at gmail.com
Wed Dec 20 23:47:02 UTC 2017


Hi Brian,

Brian Burkhalter je 20. 12. 2017 ob 22:54 napisal:

Hi Peter,

On Dec 20, 2017, at 3:45 AM, Peter Levart <peter.levart at gmail.com_ _<mailto:peter.levart at gmail.com>> wrote:

if (result == null) { result = copy; } else { bufs = new ArrayList<>(8); // <— ?_ _bufs.add(result);_ _bufs.add(copy);_ _}_ _I am probably missing something here, but if the do-while loop_ _iterates three or more times with nread > 0 each time won’t data be lost? Should this not instead be: if (result == null) { result = copy; } else { if (bufs == null) { bufs = new ArrayList<>(8); bufs.add(result); } bufs.add(copy); } Thanks, Brian

Yes, of course. Good catch. Next time I should try running the code before proposing it...

webrev.03 looks good.

Regards, Peter



More information about the core-libs-dev mailing list