ByteChannel
Sequential (non-concurrent) byte channel implementation
Properties
Functions
Ensures that when the given job is canceled, the ByteChannel is canceled with the same exception.
Suspend the channel until it has min bytes or gets closed. Throws exception if the channel was closed with an error. If there are bytes available in the channel, this function returns immediately.
Flush all pending bytes from writeBuffer to the internal read buffer without suspension and initiate channel close.
Suspends the channel until it is exhausted or gets closed. If the read buffer is empty, it suspends until there are bytes available in the channel. Once the channel is exhausted or closed, this function returns.
Flush all pending bytes from writeBuffer to the internal read buffer without suspension.
Wraps this channel to execute the provided action when closed using flushAndClose()
.
Retrieves, but does not consume, up to the specified number of bytes from the current position in this ByteReadChannel.
Invokes block if it is possible to read at least min byte providing buffer to it so lambda can read from the buffer up to Buffer.readRemaining bytes. If there are no min bytes available then the invocation returns -1.
Reads all available bytes to dst buffer and returns immediately or suspends if no bytes available
Reads all available bytes to dst buffer and returns immediately or suspends if no bytes available
Reads a packet of packet bytes from the channel.
Reads bytes from the ByteReadChannel until a specified sequence of bytes is encountered or the specified limit is reached.
Reads a line of UTF-8 characters from the ByteReadChannel
. It recognizes CR, LF and CRLF as line delimiters.
Reads a line of UTF-8 characters to the specified out buffer. It recognizes CR, LF and CRLF as a line delimiter.
Skips the specified byteString in the ByteReadChannel if it is found at the current position.
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.