class Readable
package haxe.io
implements IReadable
extended by FileReadStream
Available on all platforms
A readable stream.
This is an abstract base class that should never be used directly. Instead,
subclasses should override the internalRead method.
Constructor
Variables
read onlydone:Bool = false
Whether this stream is finished. When true, no further signals will be
emmited by this instance.
read onlyflowing:Bool = false
Whether data is flowing at the moment. When flowing, data signals will be emitted and the internal buffer will be empty.
highWaterMark:Int = 8192
High water mark. Readable will call internalRead pre-emptively to fill
up the internal buffer up to this value when possible. Set to 0 to
disable pre-emptive reading.
Methods
privateasyncRead (chunks:Array<Bytes>, eof:Bool):Void
This method should be used internally from internalRead to provide data
resulting from asynchronous operations. The arguments to this method are
the same as ReadableResult.Data. See internalRead for more details.
privateinternalRead (remaining:Int):ReadResult
This method should be overridden by a subclass.
This method will be called as needed by Readable. The remaining
argument is an indication of how much data is needed to fill the internal
buffer up to the high water mark, or the current requested amount of data.
This method is called in a cycle until the read cycle is stopped with a
None return or an EOF is indicated, as described below.
If a call to this method returns None, the current read cycle is
ended. This value should be returned when there is no data available at the
moment, but a read request was scheduled and will later be fulfilled by a
call to asyncRead.
If a call to this method returns Data(chunks, eof), chunks will be
added to the internal buffer. If eof is true, the read cycle is ended
and the readable stream signals an EOF (end-of-file). After an EOF, no
further calls will be made. chunks should not be an empty array if eof
is false.
Code inside this method should only call asyncRead (asynchronously from
a callback) or provide data using the return value.