kotlinx-io icon indicating copy to clipboard operation
kotlinx-io copied to clipboard

[io-2] Output->Input pipe

Open altavir opened this issue 6 years ago • 0 comments
trafficstars

I've already encountered multiple cases, where I need to use direct pipe, that has Output on one side and an Input on the other side. Old io had copyTo operation, but it does not fully implement what I need, because one still needs some way to create those inputs and outputs, which in most cases requires additional copy operations. I am not sure about implementation yet, so putting it here for consideration for now. Probably there should be a specialized object, let's call it a Pipe, which implements both Input and Output (or provides input and output as properties). Inside that object there should be a synchronized queue of buffers, which could be written from one side and read from the other. The Pipe also should have an option to wait for the input which probably can't be done without coroutines.

altavir avatar Nov 16 '19 08:11 altavir