takeWhile

inline fun Input.takeWhile(block: (Buffer) -> Boolean): Unit

Invoke block function for every chunk until end of input or block function return false block function returns true to request more chunks or false to stop loop

It is not guaranteed that every chunk will have fixed size but it will be never empty. block function should never release provided buffer and should not write to it otherwise an undefined behaviour could be observed