RFR: 8272297: FileInputStream should override transferTo() for better performance [v2]

Alan Bateman alanb at openjdk.java.net
Fri Aug 13 08:15:27 UTC 2021


On Thu, 12 Aug 2021 21:07:53 GMT, Brian Burkhalter <bpb at 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`.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8272297: Set source position after FC.transferTo(); add test

src/java.base/share/classes/java/io/FileInputStream.java line 377:

> 375:             }
> 376:         }
> 377:         return super.transferTo(out);

I think there is also another bug here for the case that transferTo does a partial transfer, it should be:
  return transferred + super.transferTo(out));

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

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


More information about the core-libs-dev mailing list