FixIO Documentation

Back to summary

import "io/async";

AsyncStream class

Asynchronous stream.

Subclasses: AsyncTCPConnection

Functions

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.
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.
function close()
Closes the stream.