Gio.OutputStream¶
| Subclasses: | Gio.FileOutputStream,Gio.FilterOutputStream,Gio.MemoryOutputStream,Gio.UnixOutputStream | 
|---|
Methods¶
| Inherited: | GObject.Object (37) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| clear_pending() | |
| close(cancellable) | |
| close_async(io_priority, cancellable, callback, *user_data) | |
| close_finish(result) | |
| flush(cancellable) | |
| flush_async(io_priority, cancellable, callback, *user_data) | |
| flush_finish(result) | |
| has_pending() | |
| is_closed() | |
| is_closing() | |
| set_pending() | |
| splice(source, flags, cancellable) | |
| splice_async(source, flags, io_priority, cancellable, callback, *user_data) | |
| splice_finish(result) | |
| write(buffer, cancellable) | |
| write_all(buffer, cancellable) | |
| write_all_async(buffer, io_priority, cancellable, callback, *user_data) | |
| write_all_finish(result) | |
| write_async(buffer, io_priority, cancellable, callback, *user_data) | |
| write_bytes(bytes, cancellable) | |
| write_bytes_async(bytes, io_priority, cancellable, callback, *user_data) | |
| write_bytes_finish(result) | |
| write_finish(result) | |
| writev(vectors, cancellable) | |
| writev_all(vectors, cancellable) | |
| writev_all_async(vectors, io_priority, cancellable, callback, *user_data) | |
| writev_all_finish(result) | |
| writev_async(vectors, io_priority, cancellable, callback, *user_data) | |
| writev_finish(result) | 
Virtual Methods¶
| Inherited: | GObject.Object (7) | 
|---|
| do_close_async(io_priority, cancellable, callback, *user_data) | |
| do_close_finish(result) | |
| do_close_fn(cancellable) | |
| do_flush(cancellable) | |
| do_flush_async(io_priority, cancellable, callback, *user_data) | |
| do_flush_finish(result) | |
| do_splice(source, flags, cancellable) | |
| do_splice_async(source, flags, io_priority, cancellable, callback, *user_data) | |
| do_splice_finish(result) | |
| do_write_async(buffer, io_priority, cancellable, callback, *user_data) | |
| do_write_finish(result) | |
| do_write_fn(buffer, cancellable) | |
| do_writev_async(vectors, io_priority, cancellable, callback, *user_data) | |
| do_writev_finish(result) | |
| do_writev_fn(vectors, cancellable) | 
Properties¶
None
Signals¶
| Inherited: | GObject.Object (1) | 
|---|
Class Details¶
- 
class Gio.OutputStream(**kwargs)¶
- Bases: - GObject.Object- Abstract: - Yes - Structure: - Gio.OutputStreamClass- Gio.OutputStreamhas functions to write to a stream (- Gio.OutputStream.write()), to close a stream (- Gio.OutputStream.close()) and to flush pending writes (- Gio.OutputStream.flush()).- To copy the content of an input stream to an output stream without manually handling the reads and writes, use - Gio.OutputStream.splice().- See the documentation for - Gio.IOStreamfor details of thread safety of streaming APIs.- All of these functions have async variants too. - 
close(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional cancellable object- Raises: - GLib.Error- Returns: - Trueon success,- Falseon failure- Return type: - bool- Closes the stream, releasing resources related to it. - Once the stream is closed, all other operations will return - Gio.IOErrorEnum.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 - Gio.IOErrorEnum.CLOSEDfor 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 - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill 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.
 - 
close_async(io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - io_priority (int) – the io priority of the request.
- cancellable (Gio.CancellableorNone) – optional cancellable object
- callback (Gio.AsyncReadyCallbackorNone) – callback to call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - 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 - Gio.OutputStream.close_finish() to get the result of the operation.- For behaviour details see - Gio.OutputStream.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. 
- io_priority (
 - 
close_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult.- Raises: - GLib.Error- Returns: - Trueif stream was successfully closed,- Falseotherwise.- Return type: - bool- Closes an output stream. 
 - 
flush(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional cancellable object- Raises: - GLib.Error- Returns: - Trueon success,- Falseon error- Return type: - bool- 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 - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
 - 
flush_async(io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - io_priority (int) – the io priority of the request.
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Forces an asynchronous write of all user-space buffered data for the given self. For behaviour details see - Gio.OutputStream.flush().- When the operation is finished callback will be called. You can then call - Gio.OutputStream.flush_finish() to get the result of the operation.
- io_priority (
 - 
flush_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult.- Raises: - GLib.Error- Returns: - Trueif flush operation succeeded,- Falseotherwise.- Return type: - bool- Finishes flushing an output stream. 
 - 
has_pending()[source]¶
- Returns: - Trueif self has pending actions.- Return type: - bool- Checks if an output stream has pending actions. 
 - 
is_closed()[source]¶
- Returns: - Trueif self is closed.- Falseotherwise.- Return type: - bool- Checks if an output stream has already been closed. 
 - 
is_closing()[source]¶
- Returns: - Trueif self is being closed.- Falseotherwise.- Return type: - bool- 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. - New in version 2.24. 
 - 
set_pending()[source]¶
- Raises: - GLib.Error- Returns: - Trueif pending was previously unset and is now set.- Return type: - bool- Sets self to have actions pending. If the pending flag is already set or self is closed, it will return - Falseand set error.
 - 
splice(source, flags, cancellable)[source]¶
- Parameters: - source (Gio.InputStream) – aGio.InputStream.
- flags (Gio.OutputStreamSpliceFlags) – a set ofGio.OutputStreamSpliceFlags.
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.
 - Raises: - Returns: - 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 - GObject.G_MAXSSIZE, then that will be returned, and there is no way to determine the actual number of bytes spliced.- Return type: - Splices an input stream into an output stream. 
- source (
 - 
splice_async(source, flags, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - source (Gio.InputStream) – aGio.InputStream.
- flags (Gio.OutputStreamSpliceFlags) – a set ofGio.OutputStreamSpliceFlags.
- io_priority (int) – the io priority of the request.
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback.
- user_data (objectorNone) – user data passed to callback.
 - Splices a stream asynchronously. When the operation is finished callback will be called. You can then call - Gio.OutputStream.splice_finish() to get the result of the operation.- For the synchronous, blocking version of this function, see - Gio.OutputStream.splice().
- source (
 - 
splice_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult.- Raises: - GLib.Error- Returns: - a #gssize of the number of bytes spliced. Note that if the number of bytes spliced is greater than - GObject.G_MAXSSIZE, then that will be returned, and there is no way to determine the actual number of bytes spliced.- Return type: - int- Finishes an asynchronous stream splice operation. 
 - 
write(buffer, cancellable)[source]¶
- Parameters: - buffer (bytes) – the buffer containing the data to write.
- cancellable (Gio.CancellableorNone) – optional cancellable object
 - Raises: - Returns: - Number of bytes written, or -1 on error - Return type: - 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 - GObject.G_MAXSSIZEwill cause a- Gio.IOErrorEnum.INVALID_ARGUMENTerror.- 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 - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill 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. 
- buffer (
 - 
write_all(buffer, cancellable)[source]¶
- Parameters: - buffer (bytes) – the buffer containing the data to write.
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.
 - Raises: - Returns: - Trueon success,- Falseif there was an error- bytes_written: - location to store the number of bytes that was written to the stream - Return type: - Tries to write count bytes from buffer into the stream. Will block during the operation. - This function is similar to - Gio.OutputStream.write(), except it tries to write as many bytes as requested, only stopping on an error.- On a successful write of count bytes, - Trueis returned, and bytes_written is set to count.- If there is an error during the operation - Falseis returned and error is set to indicate the error status.- As a special exception to the normal conventions for functions that use - GLib.Error, if this function returns- False(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- Gio.OutputStream.write().
- buffer (
 - 
write_all_async(buffer, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - buffer (bytes) – the buffer containing the data to write
- io_priority (int) – the io priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – callback to call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - 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 - Gio.OutputStream.write_all_finish() to get the result of the operation.- This is the asynchronous version of - Gio.OutputStream.write_all().- Call - Gio.OutputStream.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 - GLib.PRIORITY_DEFAULT.- Note that no copy of buffer will be made, so it must stay valid until callback is called. - New in version 2.44. 
- buffer (
 - 
write_all_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueon success,- Falseif there was an error- bytes_written: - location to store the number of bytes that was written to the stream - Return type: - ( - bool, bytes_written:- int)- Finishes an asynchronous stream write operation started with - Gio.OutputStream.write_all_async().- As a special exception to the normal conventions for functions that use - GLib.Error, if this function returns- False(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- Gio.OutputStream.write_async().- New in version 2.44. 
 - 
write_async(buffer, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - buffer (bytes) – the buffer containing the data to write.
- io_priority (int) – the io priority of the request.
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.
- callback (Gio.AsyncReadyCallbackorNone) – callback to call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - 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 - Gio.OutputStream.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 - Gio.IOErrorEnum.PENDINGerrors.- A value of count larger than - GObject.G_MAXSSIZEwill cause a- Gio.IOErrorEnum.INVALID_ARGUMENTerror.- 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 - Gio.IOErrorEnum.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 - GLib.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 - Gio.OutputStream.write().- Note that no copy of buffer will be made, so it must stay valid until callback is called. See - Gio.OutputStream.write_bytes_async() for a- GLib.Bytesversion that will automatically hold a reference to the contents (without copying) for the duration of the call.
- buffer (
 - 
write_bytes(bytes, cancellable)[source]¶
- Parameters: - bytes (GLib.Bytes) – theGLib.Bytesto write
- cancellable (Gio.CancellableorNone) – optional cancellable object
 - Raises: - Returns: - Number of bytes written, or -1 on error - Return type: - A wrapper function for - Gio.OutputStream.write() which takes a- GLib.Bytesas input. This can be more convenient for use by language bindings or in other cases where the refcounted nature of- GLib.Bytesis helpful over a bare pointer interface.- However, note that this function may still perform partial writes, just like - Gio.OutputStream.write(). If that occurs, to continue writing, you will need to create a new- GLib.Bytescontaining just the remaining bytes, using- GLib.Bytes.new_from_bytes(). Passing the same- GLib.Bytesinstance multiple times potentially can result in duplicated data in the output stream.
- bytes (
 - 
write_bytes_async(bytes, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - bytes (GLib.Bytes) – The bytes to write
- io_priority (int) – the io priority of the request.
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.
- callback (Gio.AsyncReadyCallbackorNone) – callback to call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - This function is similar to - Gio.OutputStream.write_async(), but takes a- GLib.Bytesas input. Due to the refcounted nature of- GLib.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 - Gio.OutputStream.write_async(). If that occurs, to continue writing, you will need to create a new- GLib.Bytescontaining just the remaining bytes, using- GLib.Bytes.new_from_bytes(). Passing the same- GLib.Bytesinstance multiple times potentially can result in duplicated data in the output stream.- For the synchronous, blocking version of this function, see - Gio.OutputStream.write_bytes().
- bytes (
 - 
write_bytes_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult.- Raises: - GLib.Error- Returns: - a #gssize containing the number of bytes written to the stream. - Return type: - int- Finishes a stream write-from- - GLib.Bytesoperation.
 - 
write_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult.- Raises: - GLib.Error- Returns: - a #gssize containing the number of bytes written to the stream. - Return type: - int- Finishes a stream write operation. 
 - 
writev(vectors, cancellable)[source]¶
- Parameters: - vectors ([Gio.OutputVector]) – the buffer containing theGio.OutputVectorsto write.
- cancellable (Gio.CancellableorNone) – optional cancellable object
 - Raises: - Returns: - Trueon success,- Falseif there was an error- bytes_written: - location to store the number of bytes that were written to the stream - Return type: - Tries to write the bytes contained in the n_vectors vectors into the stream. Will block during the operation. - If n_vectors is 0 or the sum of all bytes in vectors is 0, returns 0 and does nothing. - 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 n_vectors is 0 or the sum of all bytes in vectors is 0). - If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned. If an operation was partially finished when the operation was cancelled the partial result will be returned, without an error.- Some implementations of - Gio.OutputStream.writev() may have limitations on the aggregate buffer size, and will return- Gio.IOErrorEnum.INVALID_ARGUMENTif these are exceeded. For example, when writing to a local file on UNIX platforms, the aggregate buffer size must not exceed- GObject.G_MAXSSIZEbytes.- New in version 2.60. 
- vectors ([
 - 
writev_all(vectors, cancellable)[source]¶
- Parameters: - vectors ([Gio.OutputVector]) – the buffer containing theGio.OutputVectorsto write.
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.
 - Raises: - Returns: - Trueon success,- Falseif there was an error- bytes_written: - location to store the number of bytes that were written to the stream - Return type: - Tries to write the bytes contained in the n_vectors vectors into the stream. Will block during the operation. - This function is similar to - Gio.OutputStream.writev(), except it tries to write as many bytes as requested, only stopping on an error.- On a successful write of all n_vectors vectors, - Trueis returned, and bytes_written is set to the sum of all the sizes of vectors.- If there is an error during the operation - Falseis returned and error is set to indicate the error status.- As a special exception to the normal conventions for functions that use - GLib.Error, if this function returns- False(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- Gio.OutputStream.write().- The content of the individual elements of vectors might be changed by this function. - New in version 2.60. 
- vectors ([
 - 
writev_all_async(vectors, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - vectors ([Gio.OutputVector]) – the buffer containing theGio.OutputVectorsto write.
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – callback to call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Request an asynchronous write of the bytes contained in the n_vectors vectors into the stream. When the operation is finished callback will be called. You can then call - Gio.OutputStream.writev_all_finish() to get the result of the operation.- This is the asynchronous version of - Gio.OutputStream.writev_all().- Call - Gio.OutputStream.writev_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 - GLib.PRIORITY_DEFAULT.- Note that no copy of vectors will be made, so it must stay valid until callback is called. The content of the individual elements of vectors might be changed by this function. - New in version 2.60. 
- vectors ([
 - 
writev_all_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueon success,- Falseif there was an error- bytes_written: - location to store the number of bytes that were written to the stream - Return type: - ( - bool, bytes_written:- int)- Finishes an asynchronous stream write operation started with - Gio.OutputStream.writev_all_async().- As a special exception to the normal conventions for functions that use - GLib.Error, if this function returns- False(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- Gio.OutputStream.writev_async().- New in version 2.60. 
 - 
writev_async(vectors, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - vectors ([Gio.OutputVector]) – the buffer containing theGio.OutputVectorsto write.
- io_priority (int) – the I/O priority of the request.
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.
- callback (Gio.AsyncReadyCallbackorNone) – callback to call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Request an asynchronous write of the bytes contained in n_vectors vectors into the stream. When the operation is finished callback will be called. You can then call - Gio.OutputStream.writev_finish() to get the result of the operation.- During an async request no other sync and async calls are allowed, and will result in - Gio.IOErrorEnum.PENDINGerrors.- 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 - Gio.IOErrorEnum.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 - GLib.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 - Gio.OutputStream.writev().- Note that no copy of vectors will be made, so it must stay valid until callback is called. - New in version 2.60. 
- vectors ([
 - 
writev_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult.- Raises: - GLib.Error- Returns: - Trueon success,- Falseif there was an error- bytes_written: - location to store the number of bytes that were written to the stream - Return type: - ( - bool, bytes_written:- int)- Finishes a stream writev operation. - New in version 2.60. 
 - 
do_close_async(io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - io_priority (int) – the io priority of the request.
- cancellable (Gio.CancellableorNone) – optional cancellable object
- callback (Gio.AsyncReadyCallbackorNone) – callback to call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - 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 - Gio.OutputStream.close_finish() to get the result of the operation.- For behaviour details see - Gio.OutputStream.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. 
- io_priority (
 - 
do_close_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult.- Returns: - Trueif stream was successfully closed,- Falseotherwise.- Return type: - bool- Closes an output stream. 
 - 
do_close_fn(cancellable) virtual¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) –- Return type: - bool
 - 
do_flush(cancellable) virtual¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional cancellable object- Returns: - Trueon success,- Falseon error- Return type: - bool- Forces a write of all user-space buffered data for the given stream. Will block during the operation. Closing the stream will implicitly cause a flush. - This function is optional for inherited classes. - If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
 - 
do_flush_async(io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - io_priority (int) – the io priority of the request.
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Forces an asynchronous write of all user-space buffered data for the given stream. For behaviour details see - Gio.OutputStream.flush().- When the operation is finished callback will be called. You can then call - Gio.OutputStream.flush_finish() to get the result of the operation.
- io_priority (
 - 
do_flush_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult.- Returns: - Trueif flush operation succeeded,- Falseotherwise.- Return type: - bool- Finishes flushing an output stream. 
 - 
do_splice(source, flags, cancellable) virtual¶
- Parameters: - source (Gio.InputStream) – aGio.InputStream.
- flags (Gio.OutputStreamSpliceFlags) – a set ofGio.OutputStreamSpliceFlags.
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.
 - Returns: - 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 - GObject.G_MAXSSIZE, then that will be returned, and there is no way to determine the actual number of bytes spliced.- Return type: - Splices an input stream into an output stream. 
- source (
 - 
do_splice_async(source, flags, io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - source (Gio.InputStream) – aGio.InputStream.
- flags (Gio.OutputStreamSpliceFlags) – a set ofGio.OutputStreamSpliceFlags.
- io_priority (int) – the io priority of the request.
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback.
- user_data (objectorNone) – user data passed to callback.
 - Splices a stream asynchronously. When the operation is finished callback will be called. You can then call - Gio.OutputStream.splice_finish() to get the result of the operation.- For the synchronous, blocking version of this function, see - Gio.OutputStream.splice().
- source (
 - 
do_splice_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult.- Returns: - a #gssize of the number of bytes spliced. Note that if the number of bytes spliced is greater than - GObject.G_MAXSSIZE, then that will be returned, and there is no way to determine the actual number of bytes spliced.- Return type: - int- Finishes an asynchronous stream splice operation. 
 - 
do_write_async(buffer, io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - buffer (bytesorNone) – the buffer containing the data to write.
- io_priority (int) – the io priority of the request.
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.
- callback (Gio.AsyncReadyCallbackorNone) – callback to call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - 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 - Gio.OutputStream.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 - Gio.IOErrorEnum.PENDINGerrors.- A value of count larger than - GObject.G_MAXSSIZEwill cause a- Gio.IOErrorEnum.INVALID_ARGUMENTerror.- 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 - Gio.IOErrorEnum.WOULD_BLOCK- if stream 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 - GLib.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 - Gio.OutputStream.write().- Note that no copy of buffer will be made, so it must stay valid until callback is called. See - Gio.OutputStream.write_bytes_async() for a- GLib.Bytesversion that will automatically hold a reference to the contents (without copying) for the duration of the call.
- buffer (
 - 
do_write_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult.- Returns: - a #gssize containing the number of bytes written to the stream. - Return type: - int- Finishes a stream write operation. 
 - 
do_write_fn(buffer, cancellable) virtual¶
- Parameters: - buffer (bytesorNone) – the buffer containing the data to write.
- cancellable (Gio.CancellableorNone) – optional cancellable object
 - Returns: - Number of bytes written, or -1 on error - Return type: - 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 - GObject.G_MAXSSIZEwill cause a- Gio.IOErrorEnum.INVALID_ARGUMENTerror.- 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 - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill 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. 
- buffer (
 - 
do_writev_async(vectors, io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - vectors ([Gio.OutputVector]) – the buffer containing theGio.OutputVectorsto write.
- io_priority (int) – the I/O priority of the request.
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.
- callback (Gio.AsyncReadyCallbackorNone) – callback to call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Request an asynchronous write of the bytes contained in n_vectors vectors into the stream. When the operation is finished callback will be called. You can then call - Gio.OutputStream.writev_finish() to get the result of the operation.- During an async request no other sync and async calls are allowed, and will result in - Gio.IOErrorEnum.PENDINGerrors.- 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 - Gio.IOErrorEnum.WOULD_BLOCK— if stream 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 - GLib.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 - Gio.OutputStream.writev().- Note that no copy of vectors will be made, so it must stay valid until callback is called. - New in version 2.60. 
- vectors ([
 - 
do_writev_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult.- Returns: - Trueon success,- Falseif there was an error- bytes_written: - location to store the number of bytes that were written to the stream - Return type: - ( - bool, bytes_written:- int)- Finishes a stream writev operation. - New in version 2.60. 
 - 
do_writev_fn(vectors, cancellable) virtual¶
- Parameters: - vectors ([Gio.OutputVector]) – the buffer containing theGio.OutputVectorsto write.
- cancellable (Gio.CancellableorNone) – optional cancellable object
 - Returns: - Trueon success,- Falseif there was an error- bytes_written: - location to store the number of bytes that were written to the stream - Return type: - Tries to write the bytes contained in the n_vectors vectors into the stream. Will block during the operation. - If n_vectors is 0 or the sum of all bytes in vectors is 0, returns 0 and does nothing. - 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 n_vectors is 0 or the sum of all bytes in vectors is 0). - If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned. If an operation was partially finished when the operation was cancelled the partial result will be returned, without an error.- Some implementations of - Gio.OutputStream.writev() may have limitations on the aggregate buffer size, and will return- Gio.IOErrorEnum.INVALID_ARGUMENTif these are exceeded. For example, when writing to a local file on UNIX platforms, the aggregate buffer size must not exceed- GObject.G_MAXSSIZEbytes.- New in version 2.60. 
- vectors ([
 
-