librdf_new_stream

Name

librdf_new_stream --  Constructor - create a new librdf_stream

Synopsis

librdf_stream* librdf_new_stream (librdf_world * world, void* context, int (*is_end_method) (void*), int (*next_method) (void*), void* (*get_method) (void*, int), void (*finished_method) (void*));

Arguments

world

redland world object

context

context to pass to the stream implementing objects

is_end_method

pointer to function to test for end of stream

next_method

pointer to function to move to the next statement in stream

get_method

pointer to function to get the current statement

finished_method

pointer to function to finish the stream.

Description

Creates a new stream with an implementation based on the passed in functions. The functions next_statement and end_of_stream will be called multiple times until either of them signify the end of stream by returning NULL or non 0 respectively. The finished function is called once only when the stream object is destroyed with librdf_free_stream

A mapping function can be set for the stream using librdf_stream_add_map function which allows the statements generated by the stream to be filtered and/or altered as they are generated before passing back to the user.

Return value

a new librdf_stream object or NULL on failure