GFileInputStream

GFileInputStream — File input streaming operations

Synopsis

#include <gio/gio.h>

                    GFileInputStream;
GFileInfo *         g_file_input_stream_query_info      (GFileInputStream *stream,
                                                         const char *attributes,
                                                         GCancellable *cancellable,
                                                         GError **error);
void                g_file_input_stream_query_info_async
                                                        (GFileInputStream *stream,
                                                         const char *attributes,
                                                         int io_priority,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
GFileInfo *         g_file_input_stream_query_info_finish
                                                        (GFileInputStream *stream,
                                                         GAsyncResult *result,
                                                         GError **error);

Object Hierarchy

  GObject
   +----GInputStream
         +----GFileInputStream

Implemented Interfaces

GFileInputStream implements GSeekable.

Description

GFileInputStream provides input streams that take their content from a file.

GFileInputStream implements GSeekable, which allows the input stream to jump to arbitrary positions in the file, provided the filesystem of the file allows it. To find the position of a file input stream, use g_seekable_tell(). To find out if a file input stream supports seeking, use g_seekable_stream_can_seek(). To position a file input stream, use g_seekable_seek().

Details

GFileInputStream

typedef struct _GFileInputStream GFileInputStream;

A subclass of GInputStream for opened files. This adds a few file-specific operations and seeking.

GFileInputStream implements GSeekable.


g_file_input_stream_query_info ()

GFileInfo *         g_file_input_stream_query_info      (GFileInputStream *stream,
                                                         const char *attributes,
                                                         GCancellable *cancellable,
                                                         GError **error);

Queries a file input stream the given attributes. This function blocks while querying the stream. For the asynchronous (non-blocking) version of this function, see g_file_input_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.

stream :

a GFileInputStream.

attributes :

a file attribute query string.

cancellable :

optional GCancellable object, NULL to ignore. [allow-none]

error :

a GError location to store the error occuring, or NULL to ignore.

Returns :

a GFileInfo, or NULL on error. [transfer full]

g_file_input_stream_query_info_async ()

void                g_file_input_stream_query_info_async
                                                        (GFileInputStream *stream,
                                                         const char *attributes,
                                                         int io_priority,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

Queries the stream information asynchronously. When the operation is finished callback will be called. You can then call g_file_input_stream_query_info_finish() to get the result of the operation.

For the synchronous version of this function, see g_file_input_stream_query_info().

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

stream :

a GFileInputStream.

attributes :

a file attribute query string.

io_priority :

the I/O priority of the request.

cancellable :

optional GCancellable object, NULL to ignore. [allow-none]

callback :

callback to call when the request is satisfied. [scope async]

user_data :

the data to pass to callback function. [closure]

g_file_input_stream_query_info_finish ()

GFileInfo *         g_file_input_stream_query_info_finish
                                                        (GFileInputStream *stream,
                                                         GAsyncResult *result,
                                                         GError **error);

Finishes an asynchronous info query operation.

stream :

a GFileInputStream.

result :

a GAsyncResult.

error :

a GError location to store the error occuring, or NULL to ignore.

Returns :

GFileInfo. [transfer full]

See Also

GInputStream, GDataInputStream, GSeekable