1.63 <GOutputStream>

Class: <GOutputStream>

It derives from <GObject>.

<GOutputStream> is a base class for implementing streaming output.

It has functions to write to a stream (output-stream:write), to close a stream (output-stream:close?) and to flush pending writes (output-stream:flush?).

To copy the content of an input stream to an output stream without manually handling the reads and writes, use output-stream:splice.

See the documentation for <GIOStream> for details of thread safety of streaming APIs.

All of these functions have async variants too.

All classes derived from <GOutputStream> should implement synchronous writing, splicing, flushing and closing streams, but may implement asynchronous versions.

Fields

parent-instance

Procedures

Method: output-stream:clear-pending self
Method: clear-pending self

Clears the pending flag on self.

self

Passed: a <GOutputStream>.

output stream

Method: output-stream:close-async self io-priority [cancellable] [callback]
Method: close-async self io-priority [cancellable] [callback]

Requests an asynchronous close of the stream, releasing resources related to it. When the operation is finished callback will be called. You can then call output-stream:close-finish? to get the result of the operation.

For behaviour details see output-stream:close?.

The asynchronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all.

self

Passed: a <GOutputStream>.

A <GOutputStream>.

io-priority

Passed: a 32-bit integer.

the io priority of the request.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional cancellable object

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: output-stream:close-finish? self result ⇒ %return
Method: close-finish? self result ⇒ %return

Closes an output stream.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a boolean.

#t if stream was successfully closed, #f otherwise.

Method: output-stream:close? self [cancellable] ⇒ %return
Method: close? self [cancellable] ⇒ %return

Closes the stream, releasing resources related to it.

Once the stream is closed, all other operations will return closed. Closing a stream multiple times will not return an error.

Closing a stream will automatically flush any outstanding buffers in the stream.

Streams will be automatically closed when the last reference is dropped, but you might want to call this function to make sure resources are released as early as possible.

Some streams might keep the backing store of the stream (e.g. a file descriptor) open after the stream is closed. See the documentation for the individual stream for details.

On failure the first error that happened will be reported, but the close operation will finish as much as possible. A stream that failed to close will still return closed for all operations. Still, it is important to check and report the error to the user, otherwise there might be a loss of data as all data might not be written.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned. Cancelling a close will still leave the stream closed, but there some streams can use a faster close that doesn’t block to e.g. check errors. On cancellation (as with any error) there is no guarantee that all written data will reach the target.

self

Passed: a <GOutputStream>.

A <GOutputStream>.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional cancellable object

%return

Returned: a boolean.

#t on success, #f on failure

Method: output-stream:flush-async self io-priority [cancellable] [callback]
Method: flush-async self io-priority [cancellable] [callback]

Forces an asynchronous write of all user-space buffered data for the given self. For behaviour details see output-stream:flush?.

When the operation is finished callback will be called. You can then call output-stream:flush-finish? to get the result of the operation.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

io-priority

Passed: a 32-bit integer.

the io priority of the request.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: output-stream:flush-finish? self result ⇒ %return
Method: flush-finish? self result ⇒ %return

Finishes flushing an output stream.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

result

Passed: a <GAsyncResult>.

a GAsyncResult.

%return

Returned: a boolean.

#t if flush operation succeeded, #f otherwise.

Method: output-stream:flush? self [cancellable] ⇒ %return
Method: flush? self [cancellable] ⇒ %return

Forces a write of all user-space buffered data for the given self. Will block during the operation. Closing the stream will implicitly cause a flush.

This function is optional for inherited classes.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional cancellable object

%return

Returned: a boolean.

#t on success, #f on error

Method: output-stream:has-pending? self ⇒ %return
Method: has-pending? self ⇒ %return

Checks if an output stream has pending actions.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

%return

Returned: a boolean.

#t if self has pending actions.

Method: output-stream:is-closed? self ⇒ %return
Method: is-closed? self ⇒ %return

Checks if an output stream has already been closed.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

%return

Returned: a boolean.

#t if self is closed. #f otherwise.

Method: output-stream:is-closing? self ⇒ %return
Method: is-closing? self ⇒ %return

Checks if an output stream is being closed. This can be used inside e.g. a flush implementation to see if the flush (or other i/o operation) is called from within the closing operation.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

%return

Returned: a boolean.

#t if self is being closed. #f otherwise.

Method: output-stream:set-pending? self ⇒ %return
Method: set-pending? self ⇒ %return

Sets self to have actions pending. If the pending flag is already set or self is closed, it will return #f and set error.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

%return

Returned: a boolean.

#t if pending was previously unset and is now set.

Method: output-stream:splice self source flags [cancellable] ⇒ %return
Method: splice self source flags [cancellable] ⇒ %return

Splices an input stream into an output stream.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

source

Passed: a <GInputStream>.

a <GInputStream>.

flags

Passed: a <GOutputStreamSpliceFlags>, or a list of its symbols, or one of them.

a set of <GOutputStreamSpliceFlags>.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

%return

Returned: a 64-bit integer.

a gssize containing the size of the data spliced, or -1 if an error occurred. Note that if the number of bytes spliced is greater than G_MAXSSIZE, then that will be returned, and there is no way to determine the actual number of bytes spliced.

Method: output-stream:splice-async self source flags io-priority [cancellable] [callback]
Method: splice-async self source flags io-priority [cancellable] [callback]

Splices a stream asynchronously. When the operation is finished callback will be called. You can then call output-stream:splice-finish to get the result of the operation.

For the synchronous, blocking version of this function, see output-stream:splice.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

source

Passed: a <GInputStream>.

a <GInputStream>.

flags

Passed: a <GOutputStreamSpliceFlags>, or a list of its symbols, or one of them.

a set of <GOutputStreamSpliceFlags>.

io-priority

Passed: a 32-bit integer.

the io priority of the request.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: output-stream:splice-finish self result ⇒ %return
Method: splice-finish self result ⇒ %return

Finishes an asynchronous stream splice operation.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a 64-bit integer.

a gssize of the number of bytes spliced. Note that if the number of bytes spliced is greater than G_MAXSSIZE, then that will be returned, and there is no way to determine the actual number of bytes spliced.

Method: output-stream:write self buffer [cancellable] ⇒ %return
Method: write self buffer [cancellable] ⇒ %return

Tries to write count bytes from buffer into the stream. Will block during the operation.

If count is 0, returns 0 and does nothing. A value of count larger than G_MAXSSIZE will cause a invalid-argument error.

On success, the number of bytes written to the stream is returned. It is not an error if this is not the same as the requested size, as it can happen e.g. on a partial I/O error, or if there is not enough storage in the stream. All writes block until at least one byte is written or an error occurs; 0 is never returned (unless count is 0).

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned. If an operation was partially finished when the operation was cancelled the partial result will be returned, without an error.

On error -1 is returned and error is set accordingly.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

buffer

Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer.

the buffer containing the data to write.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional cancellable object

%return

Returned: a 64-bit integer.

Number of bytes written, or -1 on error

count

Not passed: guile-gi gives the length of buffer.

the number of bytes to write

Method: output-stream:write-all self buffer [cancellable] ⇒ %return bytes-written
Method: write-all self buffer [cancellable] ⇒ %return bytes-written

Tries to write count bytes from buffer into the stream. Will block during the operation.

This function is similar to output-stream:write, except it tries to write as many bytes as requested, only stopping on an error.

On a successful write of count bytes, #t is returned, and bytes-written is set to count.

If there is an error during the operation #f is returned and error is set to indicate the error status.

As a special exception to the normal conventions for functions that use <GError>, if this function returns #f (and sets error) then bytes-written will be set to the number of bytes that were successfully written before the error was encountered. This functionality is only available from C. If you need it from another language then you must write your own loop around output-stream:write.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

buffer

Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer.

the buffer containing the data to write.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

%return

Returned: a boolean.

#t on success, #f if there was an error

bytes-written

Returned: an unsigned 64-bit integer.

location to store the number of bytes that was written to the stream

count

Not passed: guile-gi gives the length of buffer.

the number of bytes to write

Method: output-stream:write-all-async self buffer io-priority [cancellable] [callback]
Method: write-all-async self buffer io-priority [cancellable] [callback]

Request an asynchronous write of count bytes from buffer into the stream. When the operation is finished callback will be called. You can then call output-stream:write-all-finish to get the result of the operation.

This is the asynchronous version of output-stream:write-all.

Call output-stream:write-all-finish to collect the result.

Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is G_PRIORITY_DEFAULT.

Note that no copy of buffer will be made, so it must stay valid until callback is called.

self

Passed: a <GOutputStream>.

A <GOutputStream>

buffer

Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer.

the buffer containing the data to write

io-priority

Passed: a 32-bit integer.

the io priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

count

Not passed: guile-gi gives the length of buffer.

the number of bytes to write

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: output-stream:write-all-finish self result ⇒ %return bytes-written
Method: write-all-finish self result ⇒ %return bytes-written

Finishes an asynchronous stream write operation started with output-stream:write-all-async.

As a special exception to the normal conventions for functions that use <GError>, if this function returns #f (and sets error) then bytes-written will be set to the number of bytes that were successfully written before the error was encountered. This functionality is only available from C. If you need it from another language then you must write your own loop around output-stream:write-async.

self

Passed: a <GOutputStream>.

a <GOutputStream>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t on success, #f if there was an error

bytes-written

Returned: an unsigned 64-bit integer.

location to store the number of bytes that was written to the stream

Method: output-stream:write-async self buffer io-priority [cancellable] [callback]
Method: write-async self buffer io-priority [cancellable] [callback]

Request an asynchronous write of count bytes from buffer into the stream. When the operation is finished callback will be called. You can then call output-stream:write-finish to get the result of the operation.

During an async request no other sync and async calls are allowed, and will result in pending errors.

A value of count larger than G_MAXSSIZE will cause a invalid-argument error.

On success, the number of bytes written will be passed to the callback. It is not an error if this is not the same as the requested size, as it can happen e.g. on a partial I/O error, but generally we try to write as many bytes as requested.

You are guaranteed that this method will never fail with would-block - if self can’t accept more data, the method will just wait until this changes.

Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is G_PRIORITY_DEFAULT.

The asynchronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all.

For the synchronous, blocking version of this function, see output-stream:write.

Note that no copy of buffer will be made, so it must stay valid until callback is called. See output-stream:write-bytes-async for a <GBytes> version that will automatically hold a reference to the contents (without copying) for the duration of the call.

self

Passed: a <GOutputStream>.

A <GOutputStream>.

buffer

Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer.

the buffer containing the data to write.

io-priority

Passed: a 32-bit integer.

the io priority of the request.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

count

Not passed: guile-gi gives the length of buffer.

the number of bytes to write

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: output-stream:write-bytes self bytes [cancellable] ⇒ %return
Method: write-bytes self bytes [cancellable] ⇒ %return

A wrapper function for output-stream:write which takes a <GBytes> as input. This can be more convenient for use by language bindings or in other cases where the refcounted nature of <GBytes> is helpful over a bare pointer interface.

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

self

Passed: a <GOutputStream>.

a <GOutputStream>.

bytes

Passed: a <GBytes>.

the <GBytes> to write

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional cancellable object

%return

Returned: a 64-bit integer.

Number of bytes written, or -1 on error

Method: output-stream:write-bytes-async self bytes io-priority [cancellable] [callback]
Method: write-bytes-async self bytes io-priority [cancellable] [callback]

This function is similar to output-stream:write-async, but takes a <GBytes> as input. Due to the refcounted nature of <GBytes>, this allows the stream to avoid taking a copy of the data.

However, note that this function may still perform partial writes, just like output-stream:write-async. If that occurs, to continue writing, you will need to create a new <GBytes> containing just the remaining bytes, using bytes:new-from-bytes. Passing the same <GBytes> instance multiple times potentially can result in duplicated data in the output stream.

For the synchronous, blocking version of this function, see output-stream:write-bytes.

self

Passed: a <GOutputStream>.

A <GOutputStream>.

bytes

Passed: a <GBytes>.

The bytes to write

io-priority

Passed: a 32-bit integer.

the io priority of the request.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: output-stream:write-bytes-finish self result ⇒ %return
Method: write-bytes-finish self result ⇒ %return

Finishes a stream write-from-<GBytes> operation.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a 64-bit integer.

a gssize containing the number of bytes written to the stream.

Method: output-stream:write-finish self result ⇒ %return
Method: write-finish self result ⇒ %return

Finishes a stream write operation.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a 64-bit integer.

a gssize containing the number of bytes written to the stream.

Method: output-stream:writev-all-finish self result ⇒ %return bytes-written
Method: writev-all-finish self result ⇒ %return bytes-written

Finishes an asynchronous stream write operation started with g_output_stream_writev_all_async().

As a special exception to the normal conventions for functions that use <GError>, if this function returns #f (and sets error) then bytes-written will be set to the number of bytes that were successfully written before the error was encountered. This functionality is only available from C. If you need it from another language then you must write your own loop around g_output_stream_writev_async().

self

Passed: a <GOutputStream>.

a <GOutputStream>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t on success, #f if there was an error

bytes-written

Returned: an unsigned 64-bit integer.

location to store the number of bytes that were written to the stream

Method: output-stream:writev-finish self result ⇒ %return bytes-written
Method: writev-finish self result ⇒ %return bytes-written

Finishes a stream writev operation.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a boolean.

#t on success, #f if there was an error

bytes-written

Returned: an unsigned 64-bit integer.

location to store the number of bytes that were written to the stream

Virtual methods

Virtual method: output-stream:do-close-async implementor self io-priority [cancellable] [callback]

Requests an asynchronous close of the stream, releasing resources related to it. When the operation is finished callback will be called. You can then call output-stream:close-finish? to get the result of the operation.

For behaviour details see output-stream:close?.

The asynchronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all.

To override it in a new class, give register-type #:vfuncs `((close-async . ,procedure)). The procedure is called as (procedure self io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: <GOutputStream>, or a class that derives from it, or its GType number.

self

Passed: a <GOutputStream>.

A <GOutputStream>.

io-priority

Passed: a 32-bit integer.

the io priority of the request.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional cancellable object

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: output-stream:do-close-finish implementor self result ⇒ %return

Closes an output stream.

To override it in a new class, give register-type #:vfuncs `((close-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GOutputStream>, or a class that derives from it, or its GType number.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a boolean.

#t if stream was successfully closed, #f otherwise.

Virtual method: output-stream:do-close-fn implementor self [cancellable] ⇒ %return

To override it in a new class, give register-type #:vfuncs `((close-fn . ,procedure)). The procedure is called as (procedure self cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GOutputStream>, or a class that derives from it, or its GType number.

self

Passed: a <GOutputStream>.

cancellable

Passed, or left out: a <GCancellable>, or #f.

%return

Returned: a boolean.

Virtual method: output-stream:do-flush implementor self [cancellable] ⇒ %return

Forces a write of all user-space buffered data for the given self. Will block during the operation. Closing the stream will implicitly cause a flush.

This function is optional for inherited classes.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

To override it in a new class, give register-type #:vfuncs `((flush . ,procedure)). The procedure is called as (procedure self cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GOutputStream>, or a class that derives from it, or its GType number.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional cancellable object

%return

Returned: a boolean.

#t on success, #f on error

Virtual method: output-stream:do-flush-async implementor self io-priority [cancellable] [callback]

Forces an asynchronous write of all user-space buffered data for the given self. For behaviour details see output-stream:flush?.

When the operation is finished callback will be called. You can then call output-stream:flush-finish? to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((flush-async . ,procedure)). The procedure is called as (procedure self io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: <GOutputStream>, or a class that derives from it, or its GType number.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

io-priority

Passed: a 32-bit integer.

the io priority of the request.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: output-stream:do-flush-finish implementor self result ⇒ %return

Finishes flushing an output stream.

To override it in a new class, give register-type #:vfuncs `((flush-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GOutputStream>, or a class that derives from it, or its GType number.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

result

Passed: a <GAsyncResult>.

a GAsyncResult.

%return

Returned: a boolean.

#t if flush operation succeeded, #f otherwise.

Virtual method: output-stream:do-splice implementor self source flags [cancellable] ⇒ %return

Splices an input stream into an output stream.

To override it in a new class, give register-type #:vfuncs `((splice . ,procedure)). The procedure is called as (procedure self source flags cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GOutputStream>, or a class that derives from it, or its GType number.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

source

Passed: a <GInputStream>.

a <GInputStream>.

flags

Passed: a <GOutputStreamSpliceFlags>, or a list of its symbols, or one of them.

a set of <GOutputStreamSpliceFlags>.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

%return

Returned: a 64-bit integer.

a gssize containing the size of the data spliced, or -1 if an error occurred. Note that if the number of bytes spliced is greater than G_MAXSSIZE, then that will be returned, and there is no way to determine the actual number of bytes spliced.

Virtual method: output-stream:do-splice-async implementor self source flags io-priority [cancellable] [callback]

Splices a stream asynchronously. When the operation is finished callback will be called. You can then call output-stream:splice-finish to get the result of the operation.

For the synchronous, blocking version of this function, see output-stream:splice.

To override it in a new class, give register-type #:vfuncs `((splice-async . ,procedure)). The procedure is called as (procedure self source flags io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: <GOutputStream>, or a class that derives from it, or its GType number.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

source

Passed: a <GInputStream>.

a <GInputStream>.

flags

Passed: a <GOutputStreamSpliceFlags>, or a list of its symbols, or one of them.

a set of <GOutputStreamSpliceFlags>.

io-priority

Passed: a 32-bit integer.

the io priority of the request.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: output-stream:do-splice-finish implementor self result ⇒ %return

Finishes an asynchronous stream splice operation.

To override it in a new class, give register-type #:vfuncs `((splice-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GOutputStream>, or a class that derives from it, or its GType number.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a 64-bit integer.

a gssize of the number of bytes spliced. Note that if the number of bytes spliced is greater than G_MAXSSIZE, then that will be returned, and there is no way to determine the actual number of bytes spliced.

Virtual method: output-stream:do-write-async implementor self buffer io-priority [cancellable] [callback]

Request an asynchronous write of count bytes from buffer into the stream. When the operation is finished callback will be called. You can then call output-stream:write-finish to get the result of the operation.

During an async request no other sync and async calls are allowed, and will result in pending errors.

A value of count larger than G_MAXSSIZE will cause a invalid-argument error.

On success, the number of bytes written will be passed to the callback. It is not an error if this is not the same as the requested size, as it can happen e.g. on a partial I/O error, but generally we try to write as many bytes as requested.

You are guaranteed that this method will never fail with would-block - if self can’t accept more data, the method will just wait until this changes.

Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is G_PRIORITY_DEFAULT.

The asynchronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all.

For the synchronous, blocking version of this function, see output-stream:write.

Note that no copy of buffer will be made, so it must stay valid until callback is called. See output-stream:write-bytes-async for a <GBytes> version that will automatically hold a reference to the contents (without copying) for the duration of the call.

To override it in a new class, give register-type #:vfuncs `((write-async . ,procedure)). The procedure is called as (procedure self buffer io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: <GOutputStream>, or a class that derives from it, or its GType number.

self

Passed: a <GOutputStream>.

A <GOutputStream>.

buffer

Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer, or #f.

the buffer containing the data to write.

io-priority

Passed: a 32-bit integer.

the io priority of the request.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

count

Not passed: guile-gi gives the length of buffer.

the number of bytes to write

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: output-stream:do-write-finish implementor self result ⇒ %return

Finishes a stream write operation.

To override it in a new class, give register-type #:vfuncs `((write-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GOutputStream>, or a class that derives from it, or its GType number.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a 64-bit integer.

a gssize containing the number of bytes written to the stream.

Virtual method: output-stream:do-write-fn implementor self buffer [cancellable] ⇒ %return

Tries to write count bytes from buffer into the stream. Will block during the operation.

If count is 0, returns 0 and does nothing. A value of count larger than G_MAXSSIZE will cause a invalid-argument error.

On success, the number of bytes written to the stream is returned. It is not an error if this is not the same as the requested size, as it can happen e.g. on a partial I/O error, or if there is not enough storage in the stream. All writes block until at least one byte is written or an error occurs; 0 is never returned (unless count is 0).

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned. If an operation was partially finished when the operation was cancelled the partial result will be returned, without an error.

On error -1 is returned and error is set accordingly.

To override it in a new class, give register-type #:vfuncs `((write-fn . ,procedure)). The procedure is called as (procedure self buffer cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GOutputStream>, or a class that derives from it, or its GType number.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

buffer

Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer, or #f.

the buffer containing the data to write.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional cancellable object

%return

Returned: a 64-bit integer.

Number of bytes written, or -1 on error

count

Not passed: guile-gi gives the length of buffer.

the number of bytes to write

Virtual method: output-stream:do-writev-finish implementor self result ⇒ %return bytes-written

Finishes a stream writev operation.

To override it in a new class, give register-type #:vfuncs `((writev-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return bytes-written.

implementor

Passed: the class whose implementation to call: <GOutputStream>, or a class that derives from it, or its GType number.

self

Passed: a <GOutputStream>.

a <GOutputStream>.

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a boolean.

#t on success, #f if there was an error

bytes-written

Returned: an unsigned 64-bit integer.

location to store the number of bytes that were written to the stream