Class: Gio::IOStream
- Inherits:
-
Object
- Object
- Gio::IOStream
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#clear_pending ⇒ nil
Clears the pending flag on stream.
-
#close(cancellable) ⇒ TrueClass
Closes the stream, releasing resources related to it.
-
#close_async(io_priority, cancellable, callback, user_data) ⇒ nil
Requests an asynchronous close of the stream, releasing resources related to it.
-
#close_finish(result) ⇒ TrueClass
Closes a stream.
- #closed=(closed) ⇒ TrueClass
-
#closed? ⇒ TrueClass
Closed.
-
#has_pending ⇒ TrueClass
Checks if a stream has pending actions.
-
#input_stream ⇒ Gio::InputStream
Input-stream.
- #input_stream=(input_stream) ⇒ Gio::InputStream
-
#is_closed ⇒ TrueClass
Checks if a stream is closed.
-
#output_stream ⇒ Gio::OutputStream
Output-stream.
- #output_stream=(output_stream) ⇒ Gio::OutputStream
-
#set_pending ⇒ TrueClass
Sets stream to have actions pending.
-
#splice_async(stream2, flags, io_priority, cancellable, callback, user_data) ⇒ nil
Asyncronously splice the output stream of stream1 to the input stream of stream2, and splice the output stream of stream2 to the input stream of stream1.
Instance Method Details
#clear_pending ⇒ nil
Clears the pending flag on stream.
#close(cancellable) ⇒ TrueClass
Closes the stream, releasing resources related to it. This will also close the individual input and output streams, if they are not already closed.
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 some streams can use a faster close that doesn’t block to e.g. check errors.
The default implementation of this method just calls close on the individual input/output streams.
#close_async(io_priority, cancellable, callback, user_data) ⇒ nil
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_io_stream_close_finish() to get the result of the operation.
For behaviour details see g_io_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.
#close_finish(result) ⇒ TrueClass
Closes a stream.
#closed=(closed) ⇒ TrueClass
#closed? ⇒ TrueClass
Returns closed.
#has_pending ⇒ TrueClass
Checks if a stream has pending actions.
#input_stream ⇒ Gio::InputStream
Returns input-stream.
#input_stream=(input_stream) ⇒ Gio::InputStream
#is_closed ⇒ TrueClass
Checks if a stream is closed.
#output_stream ⇒ Gio::OutputStream
Returns output-stream.
#output_stream=(output_stream) ⇒ Gio::OutputStream
#set_pending ⇒ TrueClass
Sets stream to have actions pending. If the pending flag is already set or stream is closed, it will return false and set error.
#splice_async(stream2, flags, io_priority, cancellable, callback, user_data) ⇒ nil
Asyncronously splice the output stream of stream1 to the input stream of stream2, and splice the output stream of stream2 to the input stream of stream1.
When the operation is finished callback will be called. You can then call g_io_stream_splice_finish() to get the result of the operation.