g_memory_output_stream_get_data
g_memory_output_stream_get_size
g_memory_output_stream_get_data_size
+g_memory_output_stream_steal_data
<SUBSECTION Standard>
GMemoryOutputStreamClass
G_MEMORY_OUTPUT_STREAM
g_memory_output_stream_get_data
g_memory_output_stream_get_data_size
g_memory_output_stream_get_size
+g_memory_output_stream_steal_data
#endif
#endif
return ostream->priv->valid_len;
}
+/**
+ * g_memory_output_stream_steal_data:
+ * @ostream: a #GMemoryOutputStream
+ *
+ * Gets any loaded data from the @ostream. Ownership of the data
+ * is transferred to the caller; when no longer needed it must be
+ * freed using the free function set in @ostream's
+ * #GMemoryOutputStream:destroy-function property.
+ *
+ * @ostream must be closed before calling this function.
+ *
+ * Returns: (transfer full): the stream's data
+ *
+ * Since: 2.26
+ **/
+gpointer
+g_memory_output_stream_steal_data (GMemoryOutputStream *ostream)
+{
+ gpointer data;
+
+ g_return_val_if_fail (G_IS_MEMORY_OUTPUT_STREAM (ostream), NULL);
+ g_return_val_if_fail (g_output_stream_is_closed (G_OUTPUT_STREAM (ostream)), NULL);
+
+ data = ostream->priv->data;
+ ostream->priv->data = NULL;
+
+ return data;
+}
+
static gboolean
array_resize (GMemoryOutputStream *ostream,
gsize size,
gpointer g_memory_output_stream_get_data (GMemoryOutputStream *ostream);
gsize g_memory_output_stream_get_size (GMemoryOutputStream *ostream);
gsize g_memory_output_stream_get_data_size (GMemoryOutputStream *ostream);
+gpointer g_memory_output_stream_steal_data (GMemoryOutputStream *ostream);
G_END_DECLS