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