On Thu, 12 Aug 2021 11:30:16 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> Please consider this request to add an override 
>> `java.io.FileInputStream.transferTo(OutputStream)` with improved performance 
>> if the parameter is a `FileOutputStream`.
>
> src/java.base/share/classes/java/io/FileInputStream.java line 371:
> 
>> 369:                 // not, then use the superclass method to copy those 
>> remaining
>> 370:                 if (fci.transferTo(pos, count, fco) == count) {
>> 371:                     return count;
> 
> Are you sure this is right? FileChannel transferTo doesn't modify the source 
> channel's position so I assume the method above will finish with the 
> InputStream at its initial position rather than EOF. How are we on test 
> coverage for this case?

You're right, that is stupid. I don't think it affected the benchmark, but 
testing likely needs to be revisited.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5097

Reply via email to