/* Returns: (transfer full): a string with the data that was read before encountering any of the stop characters. Set @length to a #gsize to get the length of the string. This function will return NULL on an error.  */
char* g_data_input_stream_read_until(GDataInputStream *stream, const gchar *stop_chars, gsize *length, GCancellable *cancellable, GError **error)
/* Returns: (transfer full): a string with the data that was read before encountering any of the stop characters. Set @length to a #gsize to get the length of the string. This function will return NULL on an error.  */
char* g_data_input_stream_read_until(GDataInputStream *stream, const gchar *stop_chars, gsize *length, GCancellable *cancellable, GError **error)
{
  GBufferedInputStream *bstream;
  gchar *result;
  bstream = G_BUFFERED_INPUT_STREAM (stream);
  result = g_data_input_stream_read_upto (stream, stop_chars, -1,
                                          length, cancellable, error);
  if (result != NULL && g_buffered_input_stream_get_available (bstream) > 0)
    {
      gsize res;
      gchar b;
      res = g_input_stream_read (G_INPUT_STREAM (stream), &b, 1, NULL, NULL);
      g_assert (res == 1);
    }
  return result;
}