![]() |
![]() |
![]() |
GIO Reference Manual | ![]() |
---|---|---|---|---|
#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);
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. In addition to the generic
g_seekable_ API, GFileInputStream has its own API for seeking
and positioning. To find the position of a file input stream,
use g_file_input_stream_tell()
. To find out if a file input
stream supports seeking, use g_file_input_stream_can_seek()
.
To position a file input stream, use g_file_input_stream_seek()
.
typedef struct _GFileInputStream GFileInputStream;
A subclass of GInputStream for opened files. This adds a few file-specific operations and seeking.
GFileInputStream implements GSeekable.
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
.
|
a GFileInputStream. |
|
a file attribute query string. |
|
optional GCancellable object, NULL to ignore.
|
|
a GError location to store the error occuring, or NULL to
ignore.
|
Returns : |
a GFileInfo, or NULL on error.
|
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
|
a GFileInputStream. |
|
a file attribute query string. |
|
the I/O priority of the request. |
|
optional GCancellable object, NULL to ignore.
|
|
callback to call when the request is satisfied |
|
the data to pass to callback function |
GFileInfo* g_file_input_stream_query_info_finish (GFileInputStream *stream, GAsyncResult *result, GError **error);
Finishes an asynchronous info query operation.
|
a GFileInputStream. |
|
a GAsyncResult. |
|
a GError location to store the error occuring,
or NULL to ignore.
|
Returns : |
GFileInfo. |
goffset g_file_input_stream_tell (GFileInputStream *stream);
Gets the current position in the stream.
|
a GFileInputStream. |
Returns : |
a goffset with the position in the stream. |
gboolean g_file_input_stream_can_seek (GFileInputStream *stream);
Checks if a file input stream can be seeked.
|
a GFileInputStream. |
Returns : |
TRUE if stream can be seeked. FALSE otherwise.
|
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.
|
a GFileInputStream. |
|
a goffset to seek. |
|
a GSeekType. |
|
optional GCancellable object, NULL to ignore.
|
|
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.
|