Package io.ktor.utils.io
Types
Channel for asynchronous reading and writing of sequences of bytes. This is a buffered single-reader single-writer channel.
Sequential (non-concurrent) byte channel implementation
Channel for asynchronous reading of sequences of bytes. This is a single-reader channel.
Channel for asynchronous reading of sequences of bytes. This is a single-reader channel.
Channel for asynchronous reading of sequences of bytes. This is a single-reader channel.
Channel for asynchronous writing of sequences of bytes. This is a single-writer channel.
Channel for asynchronous writing of sequences of bytes. This is a single-writer channel.
Channel for asynchronous writing of sequences of bytes. This is a single-writer channel.
Indicates attempt to write on isClosedForWrite channel that was closed without a cause. A failed channel rethrows the original close cause exception on send attempts.
Visitor function that is invoked for every available buffer (or chunk) of a channel. The last parameter shows that the buffer is known to be the last.
Functions
Creates buffered channel for asynchronous reading and writing of sequences of bytes.
Creates buffered channel for asynchronous reading and writing of sequences of bytes.
Creates buffered channel for asynchronous reading and writing of sequences of bytes using close function to close channel.
Creates buffered channel for asynchronous reading and writing of sequences of bytes.
Creates channel for reading from the specified byte array. Please note that it could use content directly or copy its bytes depending on the platform.
Creates channel for reading from the specified byte array. Please note that it could use content directly or copy its bytes depending on the platform
Creates channel for reading from the specified byte buffer.
Creates channel for reading from the specified byte array.
Creates channel for reading from the specified byte array.
Closes this channel with no failure (successfully)
For every available bytes range invokes visitor function until it return false or end of stream encountered. The provided buffer should be never captured outside of the visitor block otherwise resource leaks, crashes and data corruptions may occur. The visitor block may be invoked multiple times, once or never.
Reads bytes from receiver channel and writes them to dst channel. Closes dst channel if fails to read or write with cause exception.
Discards all bytes in the channel and suspends until end of stream.
Discards exactly n bytes or fails if not enough bytes in the channel
Print exception stacktrace.
Print exception stacktrace.
Print exception stacktrace.
Await until at least desiredSize is available for read or EOF and invoke block function. The block function should never capture a provided Memory instance outside otherwise an undefined behaviour may occur including accidental crash or data corruption. Block function should return number of bytes consumed or 0.
Reads the specified amount of bytes and makes a byte packet from them. Fails if channel has been closed and not enough bytes available.
Reads all remaining bytes and makes a byte packet
Reads up to limit bytes and makes a byte packet or until end of stream encountered.
Reads from the channel to the specified dst byte buffer until one of the following:
Await for desiredSpace will be available for write and invoke block function providing Memory instance and the corresponding range suitable for wiring in the memory. The block function should return number of bytes were written, possibly 0.
Writes UTF16 character