copyLimited

fun copyLimited(input: InputStream, output: OutputStream, maxBytes: Long = MAX_STREAM_BYTES): Long

Copies input to output up to maxBytes.

Return

Total bytes copied.

Throws

if the limit is exceeded.