FixIO Documentation
Back to summary
import "io/async";
AsyncStream class
Asynchronous stream.
Subclasses:
AsyncTCPConnection
Initialization
static function create(): AsyncStream
-
Creates a new instance of AsyncStream class.
Stream interface
virtual function read(buf: Byte[], off: Integer, len: Integer, callback, data)
-
Initiates reading to given buffer. Once finished the callback is called. The callback
must have this signature:
function callback(data, read: Integer)
The read parameter determines how many bytes were actually read. If it's zero the stream was
closed. Negative value means error.
virtual function write(buf: Byte[], off: Integer, len: Integer, callback, data)
-
Initiates writing from given buffer. Once finished the callback is called. The callback
must have this signature:
function callback(data, written: Integer)
The written parameter determines how many bytes were actually written. Negative value means error.
virtual function close()
-
Closes the stream.