GObject.Object
Gio.OutputStream
Gio.FileOutputStream
Import line: | Gio = imports.gi.Gio; |
GIR File: | Gio-2.0.gir |
C documentation: | GFileOutputStream |
Class : | FileOutputStream |
Implements: | Gio.Seekable |
Extends: | Gio.OutputStream |
Properties | Defined By | |
---|---|---|
parent_instance : Gio.OutputStream
read only
|
Gio.FileOutputStream | |
priv : Gio.FileOutputStreamPrivate
read only
|
Gio.FileOutputStream |
Method / Constructor | Defined By | |
---|---|---|
new Gio.FileOutputStream
(Object properties)
Create a new Gio.FileOutputStream
Create a new Gio.FileOutputStream
|
||
can_seek
()
:
gboolean
Tests if the stream supports the GSeekableIface.
Tests if the stream supports the GSeekableIface.
|
Gio.Seekable | |
can_truncate
()
:
gboolean
Tests if the stream can be truncated.
Tests if the stream can be truncated.
|
Gio.Seekable | |
clear_pending
()
:
none
Clears the pending flag on stream.
Clears the pending flag on stream.
|
Gio.OutputStream | |
close
(Cancellable cancellable)
:
gboolean
Closes the stream, releasing resources related to it.
Closes the stream, releasing resources related to it.
Once the stream is closed, all other operations will return G_IO_ERROR_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 G_IO_ERROR_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 NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_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.
|
Gio.OutputStream | |
close_async
(gint32 io_priority, Cancellable cancellable, Function callback, void* user_data)
:
none
Requests an asynchronous close of the stream, releasing resources
related to it.
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 g_output_stream_close_finish() to get the result of the operation. For behaviour details see g_output_stream_close(). The asyncronous 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.
|
Gio.OutputStream | |
close_finish
(AsyncResult result)
:
gboolean
Closes an output stream.
Closes an output stream.
|
Gio.OutputStream | |
flush
(Cancellable cancellable)
:
gboolean
Flushed any outstanding buffers in the stream.
Flushed any outstanding buffers in the 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 NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned.
|
Gio.OutputStream | |
flush_async
(gint32 io_priority, Cancellable cancellable, Function callback, void* user_data)
:
none
Flushes a stream asynchronously.
Flushes a stream asynchronously.
For behaviour details see g_output_stream_flush(). When the operation is finished callback will be called. You can then call g_output_stream_flush_finish() to get the result of the operation.
|
Gio.OutputStream | |
flush_finish
(AsyncResult result)
:
gboolean
Finishes flushing an output stream.
Finishes flushing an output stream.
|
Gio.OutputStream | |
get_etag
()
:
String
Gets the entity tag for the file when it has been written.
Gets the entity tag for the file when it has been written.
This must be called after the stream has been written and closed, as the etag can change while writing.
|
Gio.FileOutputStream | |
has_pending
()
:
gboolean
Checks if an ouput stream has pending actions.
Checks if an ouput stream has pending actions.
|
Gio.OutputStream | |
is_closed
()
:
gboolean
Checks if an output stream has already been closed.
Checks if an output stream has already been closed.
|
Gio.OutputStream | |
is_closing
()
:
gboolean
Checks if an output stream is being closed.
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.
|
Gio.OutputStream | |
Queries a file output stream for the given attributes.
Queries a file output stream for the given attributes.
This function blocks while querying the stream. For the asynchronous version of this function, see g_file_output_stream_query_info_async(). While the stream is blocked, the stream will set the pending flag internally, and any other operations on the stream will fail with G_IO_ERROR_PENDING. Can fail if the stream was already closed (with error being set to G_IO_ERROR_CLOSED), the stream has pending operations (with error being set to G_IO_ERROR_PENDING), or if querying info is not supported for the stream's interface (with error being set to G_IO_ERROR_NOT_SUPPORTED). In all cases of failure, NULL will be returned. If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be set, and NULL will be returned.
|
Gio.FileOutputStream | |
query_info_async
(String attributes, gint32 io_priority, Cancellable cancellable, Function callback, void* user_data)
:
none
Asynchronously queries the stream for a GFileInfo.
Asynchronously queries the stream for a GFileInfo. When completed,
finish the operation with g_file_output_stream_query_info_finish(). For the synchronous version of this function, see g_file_output_stream_query_info().
|
Gio.FileOutputStream | |
query_info_finish
(AsyncResult result)
:
Gio.FileInfo
Finalizes the asynchronous query started
by g_file_output_stream_query_info_async().
Finalizes the asynchronous query started
by g_file_output_stream_query_info_async().
|
Gio.FileOutputStream | |
Seeks in the stream by the given offset, modified by type.
Seeks in the stream by the given offset, modified by type.
If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned. has occurred, this function will return FALSE and set error appropriately if present.
|
Gio.Seekable | |
set_pending
()
:
gboolean
Sets stream to have actions pending.
Sets stream to have actions pending. If the pending flag is
already set or stream is closed, it will return FALSE and set
|
Gio.OutputStream | |
Splices an input stream into an output stream.
Splices an input stream into an output stream.
-1 if an error occurred.
|
Gio.OutputStream | |
splice_async
(InputStream source, OutputStreamSpliceFlags flags, gint32 io_priority, Cancellable cancellable, Function callback, void* user_data)
:
none
Splices a stream asynchronously.
Splices a stream asynchronously.
When the operation is finished callback will be called. You can then call g_output_stream_splice_finish() to get the result of the operation. For the synchronous, blocking version of this function, see g_output_stream_splice().
|
Gio.OutputStream | |
splice_finish
(AsyncResult result)
:
gint32
Finishes an asynchronous stream splice operation.
Finishes an asynchronous stream splice operation.
|
Gio.OutputStream | |
tell
()
:
gint64
Tells the current position within the stream.
Tells the current position within the stream.
|
Gio.Seekable | |
Truncates a stream with a given offset.
Truncates a stream with a given offset.
If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_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. has occurred, this function will return FALSE and set error appropriately if present.
|
Gio.Seekable | |
Tries to write count bytes from buffer into the stream.
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 G_IO_ERROR_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 If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_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.
|
Gio.OutputStream | |
Tries to write count bytes from buffer into the stream.
Tries to write count bytes from buffer into the stream. Will block
during the operation. This function is similar to g_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, TRUE is returned, and bytes_written is set to count. If there is an error during the operation FALSE is returned and error is set to indicate the error status, bytes_written is updated to contain the number of bytes written into the stream before the error occurred.
|
Gio.OutputStream | |
write_async
(String buffer, guint32 count, gint32 io_priority, Cancellable cancellable, Function callback, void* user_data)
:
none
Request an asynchronous write of count bytes from buffer into
the stream.
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 g_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 G_IO_ERROR_PENDING errors. A value of count larger than G_MAXSSIZE will cause a G_IO_ERROR_INVALID_ARGUMENT error. On success, the number of bytes written will be passed to 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 G_IO_ERROR_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 G_PRIORITY_DEFAULT. The asyncronous 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 g_output_stream_write().
|
Gio.OutputStream | |
write_finish
(AsyncResult result)
:
gint32
Finishes a stream write operation.
Finishes a stream write operation.
|
Gio.OutputStream |
None |
Class / Namespace | Method / Signal / Properties |
---|---|
Gio.File
Method |
Gets an output stream for appending data to the file.
|
Gio.File
Method |
append_to_finish
(AsyncResult res)
:
Gio.FileOutputStream
Finishes an asynchronous file append operation started with
g_file_append_to_async(). |
Gio.File
Method |
Creates a new file and returns an output stream for writing to it.
|
Gio.File
Method |
create_finish
(AsyncResult res)
:
Gio.FileOutputStream
Finishes an asynchronous file create operation started with
g_file_create_async(). |
Gio.File
Method |
replace
(String etag, gboolean make_backup, FileCreateFlags flags, Cancellable cancellable)
:
Gio.FileOutputStream
Returns an output stream for overwriting the file, possibly
creating a backup copy of the file first. |
Gio.File
Method |
replace_finish
(AsyncResult res)
:
Gio.FileOutputStream
Finishes an asynchronous file replace operation started with
g_file_replace_async(). |