GFileInputStream

GFileInputStream — File input streaming operations

Synopsis


#include <gio.h>


                    GFileInputStream;
GFileInfo*          g_file_input_stream_query_info      (GFileInputStream *stream,
                                                         char *attributes,
                                                         GCancellable *cancellable,
                                                         GError **error);
void                g_file_input_stream_query_info_async
                                                        (GFileInputStream *stream,
                                                         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);
goffset             g_file_input_stream_tell            (GFileInputStream *stream);
gboolean            g_file_input_stream_can_seek        (GFileInputStream *stream);
gboolean            g_file_input_stream_seek            (GFileInputStream *stream,
                                                         goffset offset,
                                                         GSeekType type,
                                                         GCancellable *cancellable,
                                                         GError **error);


Object Hierarchy


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

Implemented Interfaces

GFileInputStream implements GSeekable.

Description

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,
                                                         char *attributes,
                                                         GCancellable *cancellable,
                                                         GError **error);

Queries a file input stream the given attributes.his 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.

error :

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

Returns :

a GFileInfo, or NULL on error.

g_file_input_stream_query_info_async ()

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

Queries the stream information asynchronously. 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.

callback :

callback to call when the request is satisfied

user_data :

the data to pass to callback function

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.

g_file_input_stream_tell ()

goffset             g_file_input_stream_tell            (GFileInputStream *stream);

Gets the current position in the stream.

stream :

a GFileInputStream.

Returns :

a goffset with the position in the stream.

g_file_input_stream_can_seek ()

gboolean            g_file_input_stream_can_seek        (GFileInputStream *stream);

Checks if a file input stream can be seeked.

stream :

a GFileInputStream.

Returns :

TRUE if stream can be seeked. FALSE otherwise.

g_file_input_stream_seek ()

gboolean            g_file_input_stream_seek            (GFileInputStream *stream,
                                                         goffset offset,
                                                         GSeekType type,
                                                         GCancellable *cancellable,
                                                         GError **error);

Seeks in the file input stream.

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.

offset :

a goffset to seek.

type :

a GSeekType.

cancellable :

optional GCancellable object, NULL to ignore.

error :

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

Returns :

TRUE if the stream was successfully seeked to the position. FALSE on error.

See Also

GInputStream, GDataInputStream, GSeekable