def transfer0(src: InputStream, sink: (Array[Byte], Int) => Unit, minBufferSize: Int, maxBufferSize: Int, bufferGrowthRatio: Int): Unit
Transfers data from the given InputStream through a to a sink function through a dynamically sized transfer buffer.
Transfers data from the given InputStream through a to a sink function through a dynamically sized transfer buffer.
The buffer is sized based on the .available number on the input stream, clamped a minBufferSize and maxBufferSize size, and allowed to grow in increments of 2x if the total amount of bytes transferred exceeds the size of the buffer by bufferGrowthRatio.
This should allow efficient processing of InputStreams of all sizes, from the tiny to the very large, without over- or under- allocating the size of the transfer buffer.