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