![]() |
![]() |
![]() |
GSF Reference Manual | ![]() |
---|---|---|---|---|
GsfInput; guint8const * gsf_input_read (GsfInput *input, size_t num_bytes, guint8 *optional_buffer); gsf_off_t gsf_input_tell (GsfInput *input); gboolean gsf_input_seek (GsfInput *input, gsf_off_t offset, GSeekType whence); GsfInfile* gsf_input_container (GsfInput *input); GsfInput* gsf_input_dup (GsfInput *input, GError **err); gsf_off_t gsf_input_size (GsfInput *input); gboolean gsf_input_eof (GsfInput *input); gsf_off_t gsf_input_remaining (GsfInput *input); GQuark gsf_input_error_id (void); GsfInput* gsf_input_sibling (GsfInput const *input, char const *name, GError **err); GQuark gsf_input_error (void); charconst * gsf_input_name (GsfInput *input); gboolean gsf_input_set_name_from_filename (GsfInput *input, char const *filename); GsfInputProxy; GsfInput* gsf_input_proxy_new (GsfInput *source); GsfInput* gsf_input_proxy_new_section (GsfInput *source, gsf_off_t offset, gsf_off_t size); gboolean gsf_input_copy (GsfInput *input, GsfOutput *output); GsfInput* gsf_input_uncompress (GsfInput *src);
GObject +----GsfInput +----GsfInfile +----GsfInputGZip +----GsfInputMemory +----GsfInputProxy +----GsfInputStdio +----GsfInputTextline
GObject +----GsfInput +----GsfInputProxy
"eof" gboolean : Read "name" gchararray : Read "position" gint64 : Read "remaining" gint64 : Read "size" gint64 : Read
guint8const * gsf_input_read (GsfInput *input, size_t num_bytes, guint8 *optional_buffer);
Read at least num_bytes
. Does not change the current position if there
is an error. Will only read if the entire amount can be read. Invalidates
the buffer associated with previous calls to gsf_input_read.
|
the input stream |
|
number of bytes to read |
|
NULL , or pointer to destination memory area
|
Returns : |
pointer to the buffer or NULL if there is an error or 0 bytes are
requested.
|
gsf_off_t gsf_input_tell (GsfInput *input);
|
the input stream |
Returns : |
the current offset in the file. |
gboolean gsf_input_seek (GsfInput *input, gsf_off_t offset, GSeekType whence);
Move the current location in the input stream.
|
the input stream |
|
target offset |
|
determines whether the offset is relative to the beginning or the end of the stream, or to the current location. |
Returns : |
TRUE on error. |
GsfInfile* gsf_input_container (GsfInput *input);
|
the input stream |
Returns : |
but does not add a reference to input 's container.
Potentially NULL
|
GsfInput* gsf_input_dup (GsfInput *input, GError **err);
Duplicates input src
leaving the new one at the same offset.
|
The input to duplicate |
|
optionally NULL
|
Returns : |
the duplicate, or NULL on error
|
gsf_off_t gsf_input_size (GsfInput *input);
Looks up and caches the number of bytes in the input
|
The input |
Returns : |
the size or -1 on error |
gboolean gsf_input_eof (GsfInput *input);
Are we at the end of the file ?
|
the input |
Returns : |
TRUE if the input is at the eof. |
gsf_off_t gsf_input_remaining (GsfInput *input);
|
the input stream |
Returns : |
the number of bytes left in the file. |
GQuark gsf_input_error_id (void);
Returns : |
A utility quark to flag a GError as being an input problem. |
GsfInput* gsf_input_sibling (GsfInput const *input, char const *name, GError **err);
|
|
|
|
|
|
Returns : |
GQuark gsf_input_error (void);
Deprecated as of GSF 1.12.0; use gsf_input_error_id()
instead.
Returns : |
A utility quark to flag a GError as being an input problem. |
charconst * gsf_input_name (GsfInput *input);
The name of the input stream.
|
the input stream |
Returns : |
input 's name in utf8 form, or NULL if it has no name.
|
gboolean gsf_input_set_name_from_filename (GsfInput *input, char const *filename);
protected.
|
the input stream |
|
the (fs-sys encoded) filename |
Returns : |
TRUE if the assignment was ok. |
GsfInput* gsf_input_proxy_new (GsfInput *source);
This creates a new proxy to the entire, given input source. See gsf_input_proxy_new_section for details.
|
The underlying data source. |
Returns : |
a new input object. |
GsfInput* gsf_input_proxy_new_section (GsfInput *source, gsf_off_t offset, gsf_off_t size);
This creates a new proxy to a section of the given source. The new object will have its own current position, but any operation on it can change the source's position.
If a proxy to a proxy is created, the intermediate proxy is short- circuited.
This function will ref the source.
|
The underlying data source. |
|
Offset into source for start of section. |
|
Length of section. |
Returns : |
a new input object. |
gboolean gsf_input_copy (GsfInput *input, GsfOutput *output);
Copy the contents from input
to output
from their respective
current positions. So if you want to be sure to copy *everything*,
make sure to call gsf_input_seek (input, 0, G_SEEK_SET) and
gsf_output_seek (output, 0, G_SEEK_SET) first, if applicable.