Java idiom for "piping"
IOUtils from the Apache Commons project has a number of utilily methods that do exactly what you need.
IOUtils.copy(in, out)
will perform a buffered copy of all input to the output. If there is more than one spot in your codebase that requires Stream
or Reader
/Writer
handling, using IOUtils could be a good idea.