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.
Flush all pending bytes from writeBuffer to the internal read buffer without suspension.
Invokes consumer when it will be possible to read at least min bytes providing byte buffer to it so lambda can read from the buffer up to ByteBuffer.remaining bytes. If there are no min bytes available then the invocation could suspend until the requirement will be met.
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 bytes from the channel and writes them to the buffer up to its limit. If the channel's read buffer is exhausted, it suspends until there are bytes available.
Reads all available bytes to dst buffer and returns immediately or suspends if no bytes available
Reads all length bytes to dst buffer or fails if channel has been closed. Suspends if not enough bytes available.
Reads a packet of packet bytes from the channel.
Reads a line of UTF-8 characters to the specified out buffer. It recognizes CR, LF and CRLF as a line delimiter.
Create blocking java.io.InputStream for this channel that does block every time the channel suspends at read Similar to do reading in runBlocking however you can pass it to regular blocking API
Create blocking java.io.OutputStream for this channel that does block every time the channel suspends at write Similar to do reading in runBlocking however you can pass it to regular blocking API
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.
Invokes block if it is possible to write at least min byte providing byte buffer to it so lambda can write to the buffer up to ByteBuffer.remaining bytes. If there are no min bytes spaces available then the invocation returns 0.