Description

Copier destination object.

If set it must implement Efl.Io.Writer interface and will receive read data once Efl.Io.Writer.can_write reports true, this is monitored using the "can_write,changed" event.

The copier will attempt to write all internal intermediate storage data at once, however the destination object may consume less. The actual data written is emitted in the "data" and "line" events.

If there is an Efl.Io.Copier.line_delimiter set then copier will use it in order to attempt to write one 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 the Efl.Io.Copier.buffer_limit is reached.

If Efl.Io.Copier.source is flagged "eos" and all data is written to the destination then the "done" event is emitted.

If the destination is not set (ie: NULL) then data is kept in a internal Eina.Binbuf, which can be stolen with Efl.Io.Copier.binbuf_steal once "data" or "line" events are emitted. It exists as a useful shortcut to easily drain readers and store all data in memory with no need to use an Efl.Io.Buffer or Efl.Io.Copier -- a source and copier are enough.

If both source and destination object implements Efl.Io.Sizer, then the destination 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 destination 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 destination classes are Efl.Io.Buffer (better to wait for all data in memory), Efl.Io.Queue (to handle streaming protocols) and Efl.Io.File (stores data to disk). Networking classes are also common destination objects.

Since 1.19

Values

Setter

Constructor-only property to set where to write data to

Since 1.19

Signature

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

C signature

Implemented by

  • Efl.Io.Copier.destination