1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = GDataInputStream.html
27  * outPack = gio
28  * outFile = DataInputStream
29  * strct   = GDataInputStream
30  * realStrct=
31  * ctorStrct=
32  * clss    = DataInputStream
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_data_input_stream_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * 	- g_data_input_stream_read_byte
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- glib.ErrorG
49  * 	- glib.GException
50  * 	- gio.AsyncResultIF
51  * 	- gio.Cancellable
52  * 	- gio.InputStream
53  * structWrap:
54  * 	- GAsyncResult* -> AsyncResultIF
55  * 	- GCancellable* -> Cancellable
56  * 	- GInputStream* -> InputStream
57  * module aliases:
58  * local aliases:
59  * overrides:
60  */
61 
62 module gio.DataInputStream;
63 
64 public  import gtkc.giotypes;
65 
66 private import gtkc.gio;
67 private import glib.ConstructionException;
68 private import gobject.ObjectG;
69 
70 
71 private import glib.Str;
72 private import glib.ErrorG;
73 private import glib.GException;
74 private import gio.AsyncResultIF;
75 private import gio.Cancellable;
76 private import gio.InputStream;
77 
78 
79 
80 private import gio.BufferedInputStream;
81 
82 /**
83  * Data input stream implements GInputStream and includes functions for
84  * reading structured data directly from a binary input stream.
85  */
86 public class DataInputStream : BufferedInputStream
87 {
88 	
89 	/** the main Gtk struct */
90 	protected GDataInputStream* gDataInputStream;
91 	
92 	
93 	public GDataInputStream* getDataInputStreamStruct()
94 	{
95 		return gDataInputStream;
96 	}
97 	
98 	
99 	/** the main Gtk struct as a void* */
100 	protected override void* getStruct()
101 	{
102 		return cast(void*)gDataInputStream;
103 	}
104 	
105 	/**
106 	 * Sets our main struct and passes it to the parent class
107 	 */
108 	public this (GDataInputStream* gDataInputStream)
109 	{
110 		super(cast(GBufferedInputStream*)gDataInputStream);
111 		this.gDataInputStream = gDataInputStream;
112 	}
113 	
114 	protected override void setStruct(GObject* obj)
115 	{
116 		super.setStruct(obj);
117 		gDataInputStream = cast(GDataInputStream*)obj;
118 	}
119 	
120 	/**
121 	 */
122 	
123 	/**
124 	 * Creates a new data input stream for the base_stream.
125 	 * Params:
126 	 * baseStream = a GInputStream.
127 	 * Throws: ConstructionException GTK+ fails to create the object.
128 	 */
129 	public this (InputStream baseStream)
130 	{
131 		// GDataInputStream * g_data_input_stream_new (GInputStream *base_stream);
132 		auto p = g_data_input_stream_new((baseStream is null) ? null : baseStream.getInputStreamStruct());
133 		if(p is null)
134 		{
135 			throw new ConstructionException("null returned by g_data_input_stream_new((baseStream is null) ? null : baseStream.getInputStreamStruct())");
136 		}
137 		this(cast(GDataInputStream*) p);
138 	}
139 	
140 	/**
141 	 * This function sets the byte order for the given stream. All subsequent
142 	 * reads from the stream will be read in the given order.
143 	 * Params:
144 	 * order = a GDataStreamByteOrder to set.
145 	 */
146 	public void setByteOrder(GDataStreamByteOrder order)
147 	{
148 		// void g_data_input_stream_set_byte_order (GDataInputStream *stream,  GDataStreamByteOrder order);
149 		g_data_input_stream_set_byte_order(gDataInputStream, order);
150 	}
151 	
152 	/**
153 	 * Gets the byte order for the data input stream.
154 	 * Returns: the stream's current GDataStreamByteOrder.
155 	 */
156 	public GDataStreamByteOrder getByteOrder()
157 	{
158 		// GDataStreamByteOrder g_data_input_stream_get_byte_order (GDataInputStream *stream);
159 		return g_data_input_stream_get_byte_order(gDataInputStream);
160 	}
161 	
162 	/**
163 	 * Sets the newline type for the stream.
164 	 * Note that using G_DATA_STREAM_NEWLINE_TYPE_ANY is slightly unsafe. If a read
165 	 * chunk ends in "CR" we must read an additional byte to know if this is "CR" or
166 	 * "CR LF", and this might block if there is no more data available.
167 	 * Params:
168 	 * type = the type of new line return as GDataStreamNewlineType.
169 	 */
170 	public void setNewlineType(GDataStreamNewlineType type)
171 	{
172 		// void g_data_input_stream_set_newline_type  (GDataInputStream *stream,  GDataStreamNewlineType type);
173 		g_data_input_stream_set_newline_type(gDataInputStream, type);
174 	}
175 	
176 	/**
177 	 * Gets the current newline type for the stream.
178 	 * Returns: GDataStreamNewlineType for the given stream.
179 	 */
180 	public GDataStreamNewlineType getNewlineType()
181 	{
182 		// GDataStreamNewlineType g_data_input_stream_get_newline_type  (GDataInputStream *stream);
183 		return g_data_input_stream_get_newline_type(gDataInputStream);
184 	}
185 	
186 	/**
187 	 * Reads a 16-bit/2-byte value from stream.
188 	 * In order to get the correct byte order for this read operation,
189 	 * see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
190 	 * Params:
191 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
192 	 * Returns: a signed 16-bit/2-byte value read from stream or 0 if an error occurred.
193 	 * Throws: GException on failure.
194 	 */
195 	public short readInt16(Cancellable cancellable)
196 	{
197 		// gint16 g_data_input_stream_read_int16 (GDataInputStream *stream,  GCancellable *cancellable,  GError **error);
198 		GError* err = null;
199 		
200 		auto p = g_data_input_stream_read_int16(gDataInputStream, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
201 		
202 		if (err !is null)
203 		{
204 			throw new GException( new ErrorG(err) );
205 		}
206 		
207 		return p;
208 	}
209 	
210 	/**
211 	 * Reads an unsigned 16-bit/2-byte value from stream.
212 	 * In order to get the correct byte order for this read operation,
213 	 * see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
214 	 * Params:
215 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
216 	 * Returns: an unsigned 16-bit/2-byte value read from the stream or 0 if an error occurred.
217 	 * Throws: GException on failure.
218 	 */
219 	public ushort readUint16(Cancellable cancellable)
220 	{
221 		// guint16 g_data_input_stream_read_uint16 (GDataInputStream *stream,  GCancellable *cancellable,  GError **error);
222 		GError* err = null;
223 		
224 		auto p = g_data_input_stream_read_uint16(gDataInputStream, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
225 		
226 		if (err !is null)
227 		{
228 			throw new GException( new ErrorG(err) );
229 		}
230 		
231 		return p;
232 	}
233 	
234 	/**
235 	 * Reads a signed 32-bit/4-byte value from stream.
236 	 * In order to get the correct byte order for this read operation,
237 	 * see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
238 	 * If cancellable is not NULL, then the operation can be cancelled by
239 	 * triggering the cancellable object from another thread. If the operation
240 	 * was cancelled, the error G_IO_ERROR_CANCELLED will be returned.
241 	 * Params:
242 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
243 	 * Returns: a signed 32-bit/4-byte value read from the stream or 0 if an error occurred.
244 	 * Throws: GException on failure.
245 	 */
246 	public int readInt32(Cancellable cancellable)
247 	{
248 		// gint32 g_data_input_stream_read_int32 (GDataInputStream *stream,  GCancellable *cancellable,  GError **error);
249 		GError* err = null;
250 		
251 		auto p = g_data_input_stream_read_int32(gDataInputStream, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
252 		
253 		if (err !is null)
254 		{
255 			throw new GException( new ErrorG(err) );
256 		}
257 		
258 		return p;
259 	}
260 	
261 	/**
262 	 * Reads an unsigned 32-bit/4-byte value from stream.
263 	 * In order to get the correct byte order for this read operation,
264 	 * see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
265 	 * If cancellable is not NULL, then the operation can be cancelled by
266 	 * triggering the cancellable object from another thread. If the operation
267 	 * was cancelled, the error G_IO_ERROR_CANCELLED will be returned.
268 	 * Params:
269 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
270 	 * Returns: an unsigned 32-bit/4-byte value read from the stream or 0 if an error occurred.
271 	 * Throws: GException on failure.
272 	 */
273 	public uint readUint32(Cancellable cancellable)
274 	{
275 		// guint32 g_data_input_stream_read_uint32 (GDataInputStream *stream,  GCancellable *cancellable,  GError **error);
276 		GError* err = null;
277 		
278 		auto p = g_data_input_stream_read_uint32(gDataInputStream, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
279 		
280 		if (err !is null)
281 		{
282 			throw new GException( new ErrorG(err) );
283 		}
284 		
285 		return p;
286 	}
287 	
288 	/**
289 	 * Reads a 64-bit/8-byte value from stream.
290 	 * In order to get the correct byte order for this read operation,
291 	 * see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
292 	 * If cancellable is not NULL, then the operation can be cancelled by
293 	 * triggering the cancellable object from another thread. If the operation
294 	 * was cancelled, the error G_IO_ERROR_CANCELLED will be returned.
295 	 * Params:
296 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
297 	 * Returns: a signed 64-bit/8-byte value read from stream or 0 if an error occurred.
298 	 * Throws: GException on failure.
299 	 */
300 	public long readInt64(Cancellable cancellable)
301 	{
302 		// gint64 g_data_input_stream_read_int64 (GDataInputStream *stream,  GCancellable *cancellable,  GError **error);
303 		GError* err = null;
304 		
305 		auto p = g_data_input_stream_read_int64(gDataInputStream, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
306 		
307 		if (err !is null)
308 		{
309 			throw new GException( new ErrorG(err) );
310 		}
311 		
312 		return p;
313 	}
314 	
315 	/**
316 	 * Reads an unsigned 64-bit/8-byte value from stream.
317 	 * In order to get the correct byte order for this read operation,
318 	 * see g_data_input_stream_get_byte_order().
319 	 * If cancellable is not NULL, then the operation can be cancelled by
320 	 * triggering the cancellable object from another thread. If the operation
321 	 * was cancelled, the error G_IO_ERROR_CANCELLED will be returned.
322 	 * Params:
323 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
324 	 * Returns: an unsigned 64-bit/8-byte read from stream or 0 if an error occurred.
325 	 * Throws: GException on failure.
326 	 */
327 	public ulong readUint64(Cancellable cancellable)
328 	{
329 		// guint64 g_data_input_stream_read_uint64 (GDataInputStream *stream,  GCancellable *cancellable,  GError **error);
330 		GError* err = null;
331 		
332 		auto p = g_data_input_stream_read_uint64(gDataInputStream, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
333 		
334 		if (err !is null)
335 		{
336 			throw new GException( new ErrorG(err) );
337 		}
338 		
339 		return p;
340 	}
341 	
342 	/**
343 	 * Reads a line from the data input stream. Note that no encoding
344 	 * checks or conversion is performed; the input is not guaranteed to
345 	 * be UTF-8, and may in fact have embedded NUL characters.
346 	 * If cancellable is not NULL, then the operation can be cancelled by
347 	 * triggering the cancellable object from another thread. If the operation
348 	 * was cancelled, the error G_IO_ERROR_CANCELLED will be returned.
349 	 * Params:
350 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
351 	 * Returns: a NUL terminated byte array with the line that was read in (without the newlines). Set length to a gsize to get the length of the read line. On an error, it will return NULL and error will be set. If there's no content to read, it will still return NULL, but error won't be set. [transfer full][array zero-terminated=1][element-type guint8]
352 	 * Throws: GException on failure.
353 	 */
354 	public string readLine(Cancellable cancellable)
355 	{
356 		// char * g_data_input_stream_read_line (GDataInputStream *stream,  gsize *length,  GCancellable *cancellable,  GError **error);
357 		gsize length;
358 		GError* err = null;
359 		
360 		auto p = g_data_input_stream_read_line(gDataInputStream, &length, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
361 		
362 		if (err !is null)
363 		{
364 			throw new GException( new ErrorG(err) );
365 		}
366 		
367 		return Str.toString(p, length);
368 	}
369 	
370 	/**
371 	 * Reads a UTF-8 encoded line from the data input stream.
372 	 * If cancellable is not NULL, then the operation can be cancelled by
373 	 * triggering the cancellable object from another thread. If the operation
374 	 * was cancelled, the error G_IO_ERROR_CANCELLED will be returned.
375 	 * Since 2.30
376 	 * Params:
377 	 * length = a gsize to get the length of the data read in. [out]
378 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
379 	 * Returns: a NUL terminated UTF-8 string with the line that was read in (without the newlines). Set length to a gsize to get the length of the read line. On an error, it will return NULL and error will be set. For UTF-8 conversion errors, the set error domain is G_CONVERT_ERROR. If there's no content to read, it will still return NULL, but error won't be set. [transfer full]
380 	 * Throws: GException on failure.
381 	 */
382 	public string readLineUtf8(out gsize length, Cancellable cancellable)
383 	{
384 		// char * g_data_input_stream_read_line_utf8 (GDataInputStream *stream,  gsize *length,  GCancellable *cancellable,  GError **error);
385 		GError* err = null;
386 		
387 		auto p = g_data_input_stream_read_line_utf8(gDataInputStream, &length, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
388 		
389 		if (err !is null)
390 		{
391 			throw new GException( new ErrorG(err) );
392 		}
393 		
394 		return Str.toString(p);
395 	}
396 	
397 	/**
398 	 * The asynchronous version of g_data_input_stream_read_line(). It is
399 	 * an error to have two outstanding calls to this function.
400 	 * When the operation is finished, callback will be called. You
401 	 * can then call g_data_input_stream_read_line_finish() to get
402 	 * the result of the operation.
403 	 * Since 2.20
404 	 * Params:
405 	 * ioPriority = the I/O priority
406 	 * of the request.
407 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
408 	 * callback = callback to call when the request is satisfied. [scope async]
409 	 * userData = the data to pass to callback function. [closure]
410 	 */
411 	public void readLineAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
412 	{
413 		// void g_data_input_stream_read_line_async (GDataInputStream *stream,  gint io_priority,  GCancellable *cancellable,  GAsyncReadyCallback callback,  gpointer user_data);
414 		g_data_input_stream_read_line_async(gDataInputStream, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
415 	}
416 	
417 	/**
418 	 * Finish an asynchronous call started by
419 	 * g_data_input_stream_read_line_async(). Note the warning about
420 	 * string encoding in g_data_input_stream_read_line() applies here as
421 	 * well.
422 	 * Since 2.20
423 	 * Params:
424 	 * result = the GAsyncResult that was provided to the callback.
425 	 * Returns: a NUL-terminated byte array with the line that was read in (without the newlines). Set length to a gsize to get the length of the read line. On an error, it will return NULL and error will be set. If there's no content to read, it will still return NULL, but error won't be set. [transfer full][array zero-terminated=1][element-type guint8]
426 	 * Throws: GException on failure.
427 	 */
428 	public string readLineFinish(out GAsyncResult result)
429 	{
430 		// char * g_data_input_stream_read_line_finish  (GDataInputStream *stream,  GAsyncResult *result,  gsize *length,  GError **error);
431 		gsize length;
432 		GError* err = null;
433 		
434 		auto p = g_data_input_stream_read_line_finish(gDataInputStream, &result, &length, &err);
435 		
436 		if (err !is null)
437 		{
438 			throw new GException( new ErrorG(err) );
439 		}
440 		
441 		return Str.toString(p, length);
442 	}
443 	
444 	/**
445 	 * Finish an asynchronous call started by
446 	 * g_data_input_stream_read_line_async().
447 	 * Since 2.30
448 	 * Params:
449 	 * result = the GAsyncResult that was provided to the callback.
450 	 * length = a gsize to get the length of the data read in. [out]
451 	 * Returns: a string with the line that was read in (without the newlines). Set length to a gsize to get the length of the read line. On an error, it will return NULL and error will be set. For UTF-8 conversion errors, the set error domain is G_CONVERT_ERROR. If there's no content to read, it will still return NULL, but error won't be set. [transfer full]
452 	 * Throws: GException on failure.
453 	 */
454 	public string readLineFinishUtf8(AsyncResultIF result, out gsize length)
455 	{
456 		// char * g_data_input_stream_read_line_finish_utf8  (GDataInputStream *stream,  GAsyncResult *result,  gsize *length,  GError **error);
457 		GError* err = null;
458 		
459 		auto p = g_data_input_stream_read_line_finish_utf8(gDataInputStream, (result is null) ? null : result.getAsyncResultTStruct(), &length, &err);
460 		
461 		if (err !is null)
462 		{
463 			throw new GException( new ErrorG(err) );
464 		}
465 		
466 		return Str.toString(p);
467 	}
468 	
469 	/**
470 	 * Reads a string from the data input stream, up to the first
471 	 * occurrence of any of the stop characters.
472 	 * In contrast to g_data_input_stream_read_until(), this function
473 	 * does not consume the stop character. You have
474 	 * to use g_data_input_stream_read_byte() to get it before calling
475 	 * g_data_input_stream_read_upto() again.
476 	 * Note that stop_chars may contain '\0' if stop_chars_len is
477 	 * specified.
478 	 * Since 2.26
479 	 * Params:
480 	 * stopChars = characters to terminate the read
481 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
482 	 * Returns: 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. [transfer full]
483 	 * Throws: GException on failure.
484 	 */
485 	public string readUpto(string stopChars, Cancellable cancellable)
486 	{
487 		// char * g_data_input_stream_read_upto (GDataInputStream *stream,  const gchar *stop_chars,  gssize stop_chars_len,  gsize *length,  GCancellable *cancellable,  GError **error);
488 		gsize length;
489 		GError* err = null;
490 		
491 		auto p = g_data_input_stream_read_upto(gDataInputStream, cast(char*)stopChars.ptr, cast(int) stopChars.length, &length, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
492 		
493 		if (err !is null)
494 		{
495 			throw new GException( new ErrorG(err) );
496 		}
497 		
498 		return Str.toString(p, length);
499 	}
500 	
501 	/**
502 	 * The asynchronous version of g_data_input_stream_read_upto().
503 	 * It is an error to have two outstanding calls to this function.
504 	 * In contrast to g_data_input_stream_read_until(), this function
505 	 * does not consume the stop character. You have
506 	 * to use g_data_input_stream_read_byte() to get it before calling
507 	 * g_data_input_stream_read_upto() again.
508 	 * Note that stop_chars may contain '\0' if stop_chars_len is
509 	 * specified.
510 	 * When the operation is finished, callback will be called. You
511 	 * can then call g_data_input_stream_read_upto_finish() to get
512 	 * the result of the operation.
513 	 * Since 2.26
514 	 * Params:
515 	 * stopChars = characters to terminate the read
516 	 * ioPriority = the I/O priority
517 	 * of the request.
518 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
519 	 * callback = callback to call when the request is satisfied. [scope async]
520 	 * userData = the data to pass to callback function. [closure]
521 	 */
522 	public void readUptoAsync(string stopChars, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
523 	{
524 		// void g_data_input_stream_read_upto_async (GDataInputStream *stream,  const gchar *stop_chars,  gssize stop_chars_len,  gint io_priority,  GCancellable *cancellable,  GAsyncReadyCallback callback,  gpointer user_data);
525 		g_data_input_stream_read_upto_async(gDataInputStream, cast(char*)stopChars.ptr, cast(int) stopChars.length, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
526 	}
527 	
528 	/**
529 	 * Finish an asynchronous call started by
530 	 * g_data_input_stream_read_upto_async().
531 	 * Note that this function does not consume the
532 	 * stop character. You have to use g_data_input_stream_read_byte() to
533 	 * get it before calling g_data_input_stream_read_upto_async() again.
534 	 * Since 2.24
535 	 * Params:
536 	 * result = the GAsyncResult that was provided to the callback
537 	 * Returns: 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. [transfer full]
538 	 * Throws: GException on failure.
539 	 */
540 	public string readUptoFinish(out GAsyncResult result)
541 	{
542 		// char * g_data_input_stream_read_upto_finish  (GDataInputStream *stream,  GAsyncResult *result,  gsize *length,  GError **error);
543 		gsize length;
544 		GError* err = null;
545 		
546 		auto p = g_data_input_stream_read_upto_finish(gDataInputStream, &result, &length, &err);
547 		
548 		if (err !is null)
549 		{
550 			throw new GException( new ErrorG(err) );
551 		}
552 		
553 		return Str.toString(p, length);
554 	}
555 	
556 	/**
557 	 * Reads a string from the data input stream, up to the first
558 	 * occurrence of any of the stop characters.
559 	 * Note that, in contrast to g_data_input_stream_read_until_async(),
560 	 * this function consumes the stop character that it finds.
561 	 * Don't use this function in new code. Its functionality is
562 	 * inconsistent with g_data_input_stream_read_until_async(). Both
563 	 * functions will be marked as deprecated in a future release. Use
564 	 * g_data_input_stream_read_upto() instead, but note that that function
565 	 * does not consume the stop character.
566 	 * Params:
567 	 * stopChars = characters to terminate the read.
568 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
569 	 * Returns: 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. [transfer full]
570 	 * Throws: GException on failure.
571 	 */
572 	public string readUntil(string stopChars, Cancellable cancellable)
573 	{
574 		// char * g_data_input_stream_read_until (GDataInputStream *stream,  const gchar *stop_chars,  gsize *length,  GCancellable *cancellable,  GError **error);
575 		gsize length;
576 		GError* err = null;
577 		
578 		auto p = g_data_input_stream_read_until(gDataInputStream, Str.toStringz(stopChars), &length, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
579 		
580 		if (err !is null)
581 		{
582 			throw new GException( new ErrorG(err) );
583 		}
584 		
585 		return Str.toString(p, length);
586 	}
587 	
588 	/**
589 	 * The asynchronous version of g_data_input_stream_read_until().
590 	 * It is an error to have two outstanding calls to this function.
591 	 * Note that, in contrast to g_data_input_stream_read_until(),
592 	 * this function does not consume the stop character that it finds. You
593 	 * must read it for yourself.
594 	 * When the operation is finished, callback will be called. You
595 	 * can then call g_data_input_stream_read_until_finish() to get
596 	 * the result of the operation.
597 	 * Don't use this function in new code. Its functionality is
598 	 * inconsistent with g_data_input_stream_read_until(). Both functions
599 	 * will be marked as deprecated in a future release. Use
600 	 * g_data_input_stream_read_upto_async() instead.
601 	 * Since 2.20
602 	 * Params:
603 	 * stopChars = characters to terminate the read.
604 	 * ioPriority = the I/O priority
605 	 * of the request.
606 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
607 	 * callback = callback to call when the request is satisfied. [scope async]
608 	 * userData = the data to pass to callback function. [closure]
609 	 */
610 	public void readUntilAsync(string stopChars, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
611 	{
612 		// void g_data_input_stream_read_until_async  (GDataInputStream *stream,  const gchar *stop_chars,  gint io_priority,  GCancellable *cancellable,  GAsyncReadyCallback callback,  gpointer user_data);
613 		g_data_input_stream_read_until_async(gDataInputStream, Str.toStringz(stopChars), ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
614 	}
615 	
616 	/**
617 	 * Finish an asynchronous call started by
618 	 * g_data_input_stream_read_until_async().
619 	 * Since 2.20
620 	 * Params:
621 	 * result = the GAsyncResult that was provided to the callback.
622 	 * Returns: 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. [transfer full]
623 	 * Throws: GException on failure.
624 	 */
625 	public string readUntilFinish(out GAsyncResult result)
626 	{
627 		// char * g_data_input_stream_read_until_finish  (GDataInputStream *stream,  GAsyncResult *result,  gsize *length,  GError **error);
628 		gsize length;
629 		GError* err = null;
630 		
631 		auto p = g_data_input_stream_read_until_finish(gDataInputStream, &result, &length, &err);
632 		
633 		if (err !is null)
634 		{
635 			throw new GException( new ErrorG(err) );
636 		}
637 		
638 		return Str.toString(p, length);
639 	}
640 }