InputStream to OutputStream copy


If I’ve got an in and out stream and I want to copy the in stream to the outstream until it’s exhausted (in this case downloading a file to disk), whats the simple way to do it?

Maybe the answer is staring me in the face. But it looks like i might need to go via a buffer, maybe a memory block which I reset each time I use it?


You probably want OutputStream::writeFromInputStream()


Dunno why I couldn’t see that!

I’ll have to look at what it’s doing internally - because i need a progress bar and the ability to abort it.