altavir
11/28/2019, 5:22 AMwriteInt in a suspended manner seems to be troublesome and does not really help since we would not be able to reuse Input methods for supposed SuspendedInput. It seems that is better to have some kind of ByteSource class which has single method with signature suspend fun awaitBytes(size: Int, block: Input.()->R):R. The idea is that we suspend caller untill size of bytes is fetched or at least guaranteed to be fetched in non-blocking manner. After that we can work with those bytes with regular Input -based way. Working with packages of unknown size could be a bit cumbersome, but I do not thing there are lot of cases, where we really need it.