RFR of 8180451: ByteArrayInputStream should override readAllBytes, readNBytes, and transferTo

Brian Burkhalter brian.burkhalter at oracle.com
Wed Mar 14 15:31:32 UTC 2018


Reprising this thread from three months ago [1].

A patch including the changes suggested below is at

http://cr.openjdk.java.net/~bpb/8180451/webrev.01/

with the differences between this and the prior version at

http://cr.openjdk.java.net/~bpb/8180451/webrev.00-01/

Thanks,

Brian

[1] http://mail.openjdk.java.net/pipermail/core-libs-dev/2017-December/050550.html

On Dec 12, 2017, at 11:42 AM, Paul Sandoz <paul.sandoz at oracle.com> wrote:

> 208     public synchronized long transferTo(OutputStream out) throws IOException {
> 209         int pos0 = pos;
> 210         out.write(buf, pos, count - pos);
> 211         pos = count;
> 212         return count - pos0;
> 213     }
> 
>  int len = count - pos
>  out.write(but, pos, len);
>  pos = count;
>  return len;

On Dec 12, 2017, at 12:23 PM, Brent Christian <brent.christian at oracle.com> wrote:

> The changes look fine to me.
> I would have found the test case a little easier to follow if "off"/"len" weren't named so similarly to "offset"/"length", but it's not a big deal.




More information about the core-libs-dev mailing list