No need for wrapping the output stream in a writer if we're copying raw bytes. This simplifies some of the code below.