On Sat, 19 Nov 2022 16:36:28 GMT, Markus KARG <d...@openjdk.org> wrote:
> Since JDK 18 some implementations of InputStream.transferTo, namely > FileInputStream and ChannelInputStream, offload work to lower layers using > NIO channels. This provides shorter execution time and reduced resource > consumption. Unfortunately, this effect is prevented once the input stream > itself is wrapped by a SequenceInputStream. While compared to other > InputStreams the SequenceInputStream is a rather edge case (e. g. used to > merge two files into one), nevertheless it makes sense to get rid of this > obstacle simply by implementing transferTo (e. g. by allowing to offload the > file merge, or parts of the file merge, to the operating system). As a > result, more existing applications will experience the > offloading-improvements made by JDK 18. > > To provide enhanced performance to existing applications, it makes sense to > address this impediment: SequenceInputStream.transferTo should be implemented > in a way that iteratively calls transferTo on each enumerated InputStream of > the SequenceInputStream in ordered sequence. This pull request has now been integrated. Changeset: 389b8f4b Author: Markus KARG <mar...@headcrashing.eu> Committer: Brian Burkhalter <b...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/389b8f4b788375821a8bb4b017e50f905abdad2d Stats: 37 lines in 2 files changed: 19 ins; 7 del; 11 mod 8297298: SequenceInputStream should override transferTo Reviewed-by: bpb ------------- PR: https://git.openjdk.org/jdk/pull/11248