## Provide a destination for the serialized syntax

The operation of turning RDF triples into a syntax has several alternatives from functions that do most of the work writing to a file or string to functions that allow passing in a raptor_iostream which can be entirely user-constructed.

### Serialize to a filename (`raptor_serializer_start_to_filename()`)

Serialize to a new filename (using `raptor_new_iostream_to_filename()` internally) and uses asf base URI, the file's URI.

      const char *filename = "raptor.rdf";
      raptor_serializer_start_to_filename(rdf_serializer, filename);

### Serialize to a string (`raptor_serializer_start_to_string()`)

Serialize to a string that is allocated by the serializer (using `raptor_new_iostream_to_string()` internally). The resulting string is only constructed after `raptor_serializer_serialize_end()` is called and at that point it is assigned to the string pointer passed in, with the length written to the optional length pointer. This function takes an optional base URI but may be required by some serializers.

      raptor_uri* uri = raptor_new_uri(world, "http://example.org/base");
      void *string;  /* destination for string */
      size_t length; /* length of constructed string */
      raptor_serializer* rdf_serializer = /* serializer created by some means */ ;

      raptor_serializer_start_to_string(rdf_serializer, uri,
                                        &string, &length);

### Serialize to a FILE* file handle (`raptor_serializer_start_to_file_handle()`)

Serialize to an existing open C FILE* file handle (using `raptor_new_iostream_to_file_handle()` internally). The handle is not closed after serializing is finished. This function takes an optional base URI but may be required by some serializers.

      raptor_uri* uri = raptor_new_uri(world, "http://example.org/base");
      FILE* fh = fopen("raptor.rdf", "wb");
      raptor_serializer* rdf_serializer = /* serializer created by some means */ ;

      raptor_serializer_start_to_file_handle(rdf_serializer, uri, fh);

### Serialize to an raptor_iostream (`raptor_serializer_start_to_iostream()`)

This is the most flexible serializing method as it allows writing to any raptor_iostream which can be constructed to build any form of user-generated structure via callbacks. The iostream remains owned by the caller that can continue to write to it after the serializing is finished (after `raptor_serializer_serialize_end()`) is called).

      raptor_uri* uri = raptor_new_uri(world, "http://example.org/base");
      raptor_iostream* iostream = /* iostream initialized by some means */ ;
      raptor_serializer* rdf_serializer = /* serializer created by some means */ ;

      raptor_serializer_start_to_iostream(rdf_serializer, uri, iostream);

      while( /* got RDF triples */ ) {
        raptor_statement* triple = /* ... triple made from somewhere ... */ ;
        raptor_serializer_serialize_statement(rdf_serializer, triple);
      }
      raptor_serializer_serialize_end(rdf_serializer);

      raptor_free_serializer(rdf_serializer);

      /* ... write other stuff to iostream ... */

      raptor_free_iostream(iostream);