Another use-case for io: I need to redirect input ...
# kotlinx-files
a
Another use-case for io: I need to redirect input to output. The best solution without creating intermediate buffer I found is to write:
Copy code
while (!endOfInput){
    out.writeByte(readByte())
}
If I understand current IO logic correctly, the input in general has a sequence of pooled buffers, so it would be simple to redirect those buffers directly to the output, but I can't find a way to do it with current API.
d
Isn't there a
Input.copyTo(Output)
function?
Unless it hasn't been published yet.
a
I'll check, thanks
Yeah, it is in extensions. Thanks