Top | ![]() |
![]() |
![]() |
![]() |
A stream is an abstraction for data input. It enables plugins to read data from a file, a memory buffer, a container file or some other medium.
G3DStream * g3d_stream_open_file (const gchar *filename
,const gchar *mode
);
Opens a file with the C stdio routines.
G3DStream * g3d_stream_open_structured_file (const gchar *filename
,const gchar *subfile
);
Open a file within a Structured File as G3DStream.
G3DStream * g3d_stream_open_structured_file_from_stream (G3DStream *stream
,const gchar *subfile
);
Open a file within a Structured File which is opened as a stream. At the
moment this only works for streams opened by g3d_stream_open_file()
as
the file is directly opened again.
G3DStream * g3d_stream_open_zip (const gchar *filename
,const gchar *subfile
);
Open a file within a Zip archive.
G3DStream * g3d_stream_open_zip_from_stream (G3DStream *stream
,const gchar *subfile
);
Open a file within a Zip archive which is opened as a stream. At the
moment this only works for streams opened by g3d_stream_open_file()
as
the file is directly opened again.
G3DStream *
g3d_stream_open_gzip_from_stream (G3DStream *stream
);
Reads data from a gzip-compressed stream.
G3DStream * g3d_stream_from_buffer (guint8 *buffer
,gsize size
,const gchar *title
,gboolean free_buffer
);
Use a buffer in memory as G3DStream.
buffer |
memory buffer to use |
|
size |
size of buffer |
|
title |
optional title of stream, may be NULL |
|
free_buffer |
whether to free the memory with |
G3DStream * g3d_stream_zlib_inflate_stream (G3DStream *stream
,gsize cmp_size
);
Opens a new stream to decompress zlib-deflated parts of a stream.
G3DStream * g3d_stream_new_custom (guint32 flags
,const gchar *uri
,G3DStreamReadFunc readfunc
,G3DStreamReadLineFunc readlinefunc
,G3DStreamSeekFunc seekfunc
,G3DStreamTellFunc tellfunc
,G3DStreamSizeFunc sizefunc
,G3DStreamEofFunc eoffunc
,G3DStreamCloseFunc closefunc
,gpointer data
);
Creates a new G3DStream with custom callback functions.
flags |
stream capability flags |
|
uri |
URI of new stream, must not be NULL |
|
readfunc |
read callback function |
|
readlinefunc |
read line callback function, may be NULL in which case
line reading is emulated with |
|
seekfunc |
seek callback function |
|
tellfunc |
tell callback function |
|
sizefunc |
size callback function |
|
eoffunc |
end-of-file callback function |
|
closefunc |
close callback function |
|
data |
opaque data for all callback functions |
gint g3d_stream_skip (G3DStream *stream
,goffset offset
);
Skip a number of bytes (>= 0) in stream even if it does not support seeking.
gint g3d_stream_seek (G3DStream *stream
,goffset offset
,GSeekType whence
);
Moves around the current position in the stream.
goffset
g3d_stream_tell (G3DStream *stream
);
Tells the current position in the stream.
gboolean
g3d_stream_eof (G3DStream *stream
);
Checks whether the stream has reached its end.
gboolean
g3d_stream_is_seekable (G3DStream *stream
);
Get information whether it is possible to seek in a stream.
guint32
g3d_stream_line (G3DStream *stream
);
Get the current line number from stream. This only works if line are
consequently read with g3d_stream_read_line()
, so it's only applicable
for text streams.
gsize g3d_stream_read (G3DStream *stream
,gpointer ptr
,gsize size
);
Reads a number of bytes from the stream.
gchar * g3d_stream_read_line (G3DStream *stream
,gchar *buf
,gsize size
);
Read a line (terminated by a newline character or end of file) from a stream.
gint32
g3d_stream_read_int8 (G3DStream *stream
);
Read a 1 byte signed integer from file.
gint32
g3d_stream_read_int16_be (G3DStream *stream
);
Read a 2 byte big-endian signed integer from file.
gint32
g3d_stream_read_int16_le (G3DStream *stream
);
Read a 2 byte little-endian signed integer from file.
gint32
g3d_stream_read_int32_be (G3DStream *stream
);
Read a 4 byte big-endian signed integer from file.
gint32
g3d_stream_read_int32_le (G3DStream *stream
);
Read a 4 byte little-endian signed integer from file.
G3DFloat
g3d_stream_read_float_be (G3DStream *stream
);
Read a 4 byte big-endian floating point number from file.
G3DFloat
g3d_stream_read_float_le (G3DStream *stream
);
Read a 4 byte little-endian floating point number from file.
G3DDouble
g3d_stream_read_double_be (G3DStream *stream
);
Read a 8 byte big-endian double-precision floating point number from file.
G3DDouble
g3d_stream_read_double_le (G3DStream *stream
);
Read a 8 byte little-endian double-precision floating point number from file.
gint32 g3d_stream_read_cstr (G3DStream *stream
,gchar *buffer
,gint32 max_len
);
Read a string (terminated by '\0') from stream
gint
(*G3DStreamCloseFunc) (gpointer data
);
Callback function for g3d_stream_close()
.
gboolean
(*G3DStreamEofFunc) (gpointer data
);
Callback function for g3d_stream_eof()
.
gsize (*G3DStreamReadFunc) (gpointer ptr
,gsize size
,gpointer data
);
Callback function for g3d_stream_read()
.
gchar * (*G3DStreamReadLineFunc) (gchar *buf
,gsize size
,gpointer data
);
Callback function for g3d_stream_read_line()
.
gint (*G3DStreamSeekFunc) (gpointer data
,goffset offset
,GSeekType whence
);
Callback function for g3d_stream_seek()
.
goffset
(*G3DStreamSizeFunc) (gpointer data
);
Callback function for g3d_stream_size()
.
goffset
(*G3DStreamTellFunc) (gpointer data
);
Callback function for g3d_stream_tell()
.