summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--raul/RDFWriter.h1
-rw-r--r--src/RDFWriter.cpp17
2 files changed, 18 insertions, 0 deletions
diff --git a/raul/RDFWriter.h b/raul/RDFWriter.h
index 9a5d5b3..1cbccaa 100644
--- a/raul/RDFWriter.h
+++ b/raul/RDFWriter.h
@@ -52,6 +52,7 @@ public:
void add_prefix(const std::string& prefix, const std::string& uri);
std::string expand_uri(const std::string& uri);
+ void start_to_file_handle(FILE* fd) throw (std::logic_error);
void start_to_filename(const std::string& filename) throw (std::logic_error);
void start_to_string() throw (std::logic_error);
std::string finish() throw (std::logic_error);
diff --git a/src/RDFWriter.cpp b/src/RDFWriter.cpp
index f2d5626..6a69765 100644
--- a/src/RDFWriter.cpp
+++ b/src/RDFWriter.cpp
@@ -84,6 +84,23 @@ RDFWriter::blank_id()
}
+/** Begin a serialization to a C file handle.
+ *
+ * This must be called before any write methods.
+ */
+void
+RDFWriter::start_to_file_handle(FILE* fd) throw (std::logic_error)
+{
+ if (_serializer)
+ throw std::logic_error("start_to_string called with serialization in progress");
+
+ raptor_init();
+ _serializer = raptor_new_serializer(RDF_LANG);
+ raptor_serialize_start_to_file_handle(_serializer, NULL, fd);
+ setup_prefixes();
+}
+
+
/** Begin a serialization to a file.
*
* This must be called before any write methods.