write_bytes_async


Description:

public async ssize_t write_bytes_async (Bytes bytes, int io_priority = DEFAULT, Cancellable? cancellable = null) throws Error

This function is similar to write_async, but takes a Bytes as input.

Due to the refcounted nature of Bytes, this allows the stream to avoid taking a copy of the data.

However, note that this function may still perform partial writes, just like write_async. If that occurs, to continue writing, you will need to create a new Bytes containing just the remaining bytes, using Bytes.from_bytes. Passing the same Bytes instance multiple times potentially can result in duplicated data in the output stream.

For the synchronous, blocking version of this function, see write_bytes .

Parameters:

this

A OutputStream.

bytes

The bytes to write

io_priority

the io priority of the request.

cancellable

optional Cancellable object, null to ignore.

callback

a TaskReadyCallback to call when the request is satisfied

user_data

the data to pass to callback function