As I explained in a recent video (https://youtu.be/qgDfZgreN40), InputStream::transferTo() is the most comfortable way to tell java we want to transfer the remaining content of one stream into another stream, but that it apparently is the slowest one, too! The reason is scary, as you will see in this inside look under OpenJDK’s hood. But rescue is on the way! I have filed a PR with #OpenJDK to make it lightning fast: https://github.com/openjdk/jdk/pull/4263.
If you like this video, please give it a thumbs up, share it, subscribe to my channel, or become my patreon https://www.patreon.com/mkarg. Thanks! 🙂