gio.input_stream
Module for [InputStream] class
Types 3
[gio.input_stream.InputStream] is a base class for implementing streaming input.
It has functions to read from a stream ([gio.input_stream.InputStream.read]), to close a stream ([gio.input_stream.InputStream.close]) and to skip some content ([gio.input_stream.InputStream.skip]).
To copy the content of an input stream to an output stream without manually handling the reads and writes, use [gio.output_stream.OutputStream.splice].
See the documentation for [gio.iostream.IOStream] for details of thread safety of streaming APIs.
All of these functions have async variants too.
Methods
InputStream self()Returns `this`, for use in `with` statements.InputStreamGidBuilder builder()Get builder for [gio.input_stream.InputStream] Returns: New builder objectvoid clearPending()Clears the pending flag on stream.bool close(gio.cancellable.Cancellable cancellable = null)Closes the stream, releasing resources related to it.void closeAsync(int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Requests an asynchronous closes of the stream, releasing resources related to it. When the operation is finished callback will be called. You can then call [gio.input_stream.InputStream.closeFinish...bool closeFinish(gio.async_result.AsyncResult result)Finishes closing a stream asynchronously, started from [gio.input_stream.InputStream.closeAsync].bool hasPending()Checks if an input stream has pending actions. Returns: true if stream has pending actions.bool isClosed()Checks if an input stream is closed. Returns: true if the stream is closed.ptrdiff_t read(ref ubyte[] buffer, gio.cancellable.Cancellable cancellable = null)Tries to read count bytes from the stream into the buffer starting at buffer. Will block during this read.bool readAll(ref ubyte[] buffer, out size_t bytesRead, gio.cancellable.Cancellable cancellable = null)Tries to read count bytes from the stream into the buffer starting at buffer. Will block during this read.void readAllAsync(ref ubyte[] buffer, int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Request an asynchronous read of count bytes from the stream into the buffer starting at buffer.bool readAllFinish(gio.async_result.AsyncResult result, out size_t bytesRead)Finishes an asynchronous stream read operation started with [gio.input_stream.InputStream.readAllAsync].void readAsync(ref ubyte[] buffer, int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Request an asynchronous read of count bytes from the stream into the buffer starting at buffer. When the operation is finished callback will be called. You can then call [gio.input_stream.InputStre...glib.bytes.Bytes readBytes(size_t count, gio.cancellable.Cancellable cancellable = null)Like [gio.input_stream.InputStream.read], this tries to read count bytes from the stream in a blocking fashion. However, rather than reading into a user-supplied buffer, this will create a new #GBy...void readBytesAsync(size_t count, int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Request an asynchronous read of count bytes from the stream into a new #GBytes. When the operation is finished callback will be called. You can then call [gio.input_stream.InputStream.readBytesFini...glib.bytes.Bytes readBytesFinish(gio.async_result.AsyncResult result)Finishes an asynchronous stream read-into-#GBytes operation.ptrdiff_t readFinish(gio.async_result.AsyncResult result)Finishes an asynchronous stream read operation.bool setPending()Sets stream to have actions pending. If the pending flag is already set or stream is closed, it will return false and set error. Returns: true if pending was previously unset and is now set. Throws...ptrdiff_t skip(size_t count, gio.cancellable.Cancellable cancellable = null)Tries to skip count bytes from the stream. Will block during the operation.void skipAsync(size_t count, int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Request an asynchronous skip of count bytes from the stream. When the operation is finished callback will be called. You can then call [gio.input_stream.InputStream.skipFinish] to get the result of...ptrdiff_t skipFinish(gio.async_result.AsyncResult result)Finishes a stream skip operation.Fluent builder for [gio.input_stream.InputStream]
Methods