Description

Copier source object.

The source object must implement the Efl.Io.Reader interface and will provide data to the copier, thus it must be provided in order for the copier to work.

The copier will monitor Efl.Io.Reader.can_read property and "can_read,changed" event. When true a chunk (limited by Efl.Io.Copier.read_chunk_size) is read using Efl.Io.Reader.read into an intermediate storage buffer which can grow up to the Efl.Io.Copier.buffer_limit.

If there's a Efl.Io.Copier.destination, the read data is written there and afterwards "data" and "line" events are dispatched. If no destination, it's accumulated in the internal storage and "data" and "line" events are dispatched immediately.

If there is a Efl.Io.Copier.line_delimiter set, then copier will use that in order to attempt to write a full line at a time, including the delimiter. Exceptions may be if the Efl.Io.Copier.source object emitted "eos" and there is no trailing delimiter (ie: missing trailing newline in files) or if the Efl.Io.Copier.buffer_limit is reached.

Once Efl.Io.Reader.eos is true or "eos" event happen, then the read process is over. If there is no Efl.Io.Copier.destination set, then the process is over and "done" event is called. If there's a Efl.Io.Copier.destination, then all data must be flushed to it, draining the internal intermediate storage before "done" event is emitted.

If the source object implements Efl.Io.Sizer interface, then the Efl.Io.Copier.progress will report the total size. If the destination object also implements Efl.Io.Sizer then it will be resized to match the source size/ It also offers hints to enhance performance such as pre-allocating the total amount and avoid dynamic resize.

If the source object implements Efl.Io.Closer and it's not closed, it will be closed when the copier itself is. This may happen, for example, when the copier is deleted and Efl.Io.Closer.close_on_destructor is true (the default).

Common source classes are Efl.Io.Buffer (if fixed data exists in memory), Efl.Io.Queue (used to stream in-memory data) and Efl.Io.File (data is present in the file system). Networking classes are also common source objects.

Since 1.19

Values

Setter

Constructor-only property to set where to read data from

Since 1.19

Signature

@property source {
    get {
        values {
            source: free(Efl.Io.Reader, efl_del);
        }
    }
    set {
        values {
            source: free(Efl.Io.Reader, efl_del);
        }
    }
}

C signature

Implemented by

  • Efl.Io.Copier.source