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 = GOutputStream.html 27 * outPack = gio 28 * outFile = OutputStream 29 * strct = GOutputStream 30 * realStrct= 31 * ctorStrct= 32 * clss = OutputStream 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = GObject 38 * implements: 39 * prefixes: 40 * - g_output_stream_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.ErrorG 47 * - glib.GException 48 * - glib.Bytes 49 * - gio.AsyncResultIF 50 * - gio.Cancellable 51 * - gio.InputStream 52 * structWrap: 53 * - GAsyncResult* -> AsyncResultIF 54 * - GBytes* -> Bytes 55 * - GCancellable* -> Cancellable 56 * - GInputStream* -> InputStream 57 * module aliases: 58 * local aliases: 59 * overrides: 60 */ 61 62 module gio.OutputStream; 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.ErrorG; 72 private import glib.GException; 73 private import glib.Bytes; 74 private import gio.AsyncResultIF; 75 private import gio.Cancellable; 76 private import gio.InputStream; 77 78 79 80 private import gobject.ObjectG; 81 82 /** 83 * GOutputStream has functions to write to a stream (g_output_stream_write()), 84 * to close a stream (g_output_stream_close()) and to flush pending writes 85 * (g_output_stream_flush()). 86 * 87 * To copy the content of an input stream to an output stream without 88 * manually handling the reads and writes, use g_output_stream_splice(). 89 * 90 * All of these functions have async variants too. 91 */ 92 public class OutputStream : ObjectG 93 { 94 95 /** the main Gtk struct */ 96 protected GOutputStream* gOutputStream; 97 98 99 public GOutputStream* getOutputStreamStruct() 100 { 101 return gOutputStream; 102 } 103 104 105 /** the main Gtk struct as a void* */ 106 protected override void* getStruct() 107 { 108 return cast(void*)gOutputStream; 109 } 110 111 /** 112 * Sets our main struct and passes it to the parent class 113 */ 114 public this (GOutputStream* gOutputStream) 115 { 116 super(cast(GObject*)gOutputStream); 117 this.gOutputStream = gOutputStream; 118 } 119 120 protected override void setStruct(GObject* obj) 121 { 122 super.setStruct(obj); 123 gOutputStream = cast(GOutputStream*)obj; 124 } 125 126 /** 127 */ 128 129 /** 130 * Tries to write count bytes from buffer into the stream. Will block 131 * during the operation. 132 * If count is 0, returns 0 and does nothing. A value of count 133 * larger than G_MAXSSIZE will cause a G_IO_ERROR_INVALID_ARGUMENT error. 134 * On success, the number of bytes written to the stream is returned. 135 * It is not an error if this is not the same as the requested size, as it 136 * can happen e.g. on a partial I/O error, or if there is not enough 137 * storage in the stream. All writes block until at least one byte 138 * is written or an error occurs; 0 is never returned (unless 139 * count is 0). 140 * If cancellable is not NULL, then the operation can be cancelled by 141 * triggering the cancellable object from another thread. If the operation 142 * was cancelled, the error G_IO_ERROR_CANCELLED will be returned. If an 143 * operation was partially finished when the operation was cancelled the 144 * partial result will be returned, without an error. 145 * On error -1 is returned and error is set accordingly. 146 * Virtual: write_fn 147 * Params: 148 * buffer = the buffer containing the data to write. [array length=count][element-type guint8] 149 * count = the number of bytes to write 150 * cancellable = optional cancellable object. [allow-none] 151 * Returns: Number of bytes written, or -1 on error 152 * Throws: GException on failure. 153 */ 154 public gssize write(void* buffer, gsize count, Cancellable cancellable) 155 { 156 // gssize g_output_stream_write (GOutputStream *stream, const void *buffer, gsize count, GCancellable *cancellable, GError **error); 157 GError* err = null; 158 159 auto p = g_output_stream_write(gOutputStream, buffer, count, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 160 161 if (err !is null) 162 { 163 throw new GException( new ErrorG(err) ); 164 } 165 166 return p; 167 } 168 169 /** 170 * Tries to write count bytes from buffer into the stream. Will block 171 * during the operation. 172 * This function is similar to g_output_stream_write(), except it tries to 173 * write as many bytes as requested, only stopping on an error. 174 * On a successful write of count bytes, TRUE is returned, and bytes_written 175 * is set to count. 176 * If there is an error during the operation FALSE is returned and error 177 * is set to indicate the error status, bytes_written is updated to contain 178 * the number of bytes written into the stream before the error occurred. 179 * Params: 180 * buffer = the buffer containing the data to write. [array length=count][element-type guint8] 181 * count = the number of bytes to write 182 * bytesWritten = location to store the number of bytes that was 183 * written to the stream. [out] 184 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 185 * Returns: TRUE on success, FALSE if there was an error 186 * Throws: GException on failure. 187 */ 188 public int writeAll(void* buffer, gsize count, gsize* bytesWritten, Cancellable cancellable) 189 { 190 // gboolean g_output_stream_write_all (GOutputStream *stream, const void *buffer, gsize count, gsize *bytes_written, GCancellable *cancellable, GError **error); 191 GError* err = null; 192 193 auto p = g_output_stream_write_all(gOutputStream, buffer, count, bytesWritten, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 194 195 if (err !is null) 196 { 197 throw new GException( new ErrorG(err) ); 198 } 199 200 return p; 201 } 202 203 /** 204 * Splices an input stream into an output stream. 205 * Params: 206 * source = a GInputStream. 207 * flags = a set of GOutputStreamSpliceFlags. 208 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 209 * Returns: a gssize containing the size of the data spliced, or -1 if an error occurred. Note that if the number of bytes spliced is greater than G_MAXSSIZE, then that will be returned, and there is no way to determine the actual number of bytes spliced. 210 * Throws: GException on failure. 211 */ 212 public gssize splice(InputStream source, GOutputStreamSpliceFlags flags, Cancellable cancellable) 213 { 214 // gssize g_output_stream_splice (GOutputStream *stream, GInputStream *source, GOutputStreamSpliceFlags flags, GCancellable *cancellable, GError **error); 215 GError* err = null; 216 217 auto p = g_output_stream_splice(gOutputStream, (source is null) ? null : source.getInputStreamStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 218 219 if (err !is null) 220 { 221 throw new GException( new ErrorG(err) ); 222 } 223 224 return p; 225 } 226 227 /** 228 * Forces a write of all user-space buffered data for the given 229 * stream. Will block during the operation. Closing the stream will 230 * implicitly cause a flush. 231 * This function is optional for inherited classes. 232 * If cancellable is not NULL, then the operation can be cancelled by 233 * triggering the cancellable object from another thread. If the operation 234 * was cancelled, the error G_IO_ERROR_CANCELLED will be returned. 235 * Params: 236 * cancellable = optional cancellable object. [allow-none] 237 * Returns: TRUE on success, FALSE on error 238 * Throws: GException on failure. 239 */ 240 public int flush(Cancellable cancellable) 241 { 242 // gboolean g_output_stream_flush (GOutputStream *stream, GCancellable *cancellable, GError **error); 243 GError* err = null; 244 245 auto p = g_output_stream_flush(gOutputStream, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 246 247 if (err !is null) 248 { 249 throw new GException( new ErrorG(err) ); 250 } 251 252 return p; 253 } 254 255 /** 256 * Closes the stream, releasing resources related to it. 257 * Once the stream is closed, all other operations will return G_IO_ERROR_CLOSED. 258 * Closing a stream multiple times will not return an error. 259 * Closing a stream will automatically flush any outstanding buffers in the 260 * stream. 261 * Streams will be automatically closed when the last reference 262 * is dropped, but you might want to call this function to make sure 263 * resources are released as early as possible. 264 * Some streams might keep the backing store of the stream (e.g. a file descriptor) 265 * open after the stream is closed. See the documentation for the individual 266 * stream for details. 267 * On failure the first error that happened will be reported, but the close 268 * operation will finish as much as possible. A stream that failed to 269 * close will still return G_IO_ERROR_CLOSED for all operations. Still, it 270 * is important to check and report the error to the user, otherwise 271 * there might be a loss of data as all data might not be written. 272 * If cancellable is not NULL, then the operation can be cancelled by 273 * triggering the cancellable object from another thread. If the operation 274 * was cancelled, the error G_IO_ERROR_CANCELLED will be returned. 275 * Cancelling a close will still leave the stream closed, but there some streams 276 * can use a faster close that doesn't block to e.g. check errors. On 277 * cancellation (as with any error) there is no guarantee that all written 278 * data will reach the target. 279 * Params: 280 * cancellable = optional cancellable object. [allow-none] 281 * Returns: TRUE on success, FALSE on failure 282 * Throws: GException on failure. 283 */ 284 public int close(Cancellable cancellable) 285 { 286 // gboolean g_output_stream_close (GOutputStream *stream, GCancellable *cancellable, GError **error); 287 GError* err = null; 288 289 auto p = g_output_stream_close(gOutputStream, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 290 291 if (err !is null) 292 { 293 throw new GException( new ErrorG(err) ); 294 } 295 296 return p; 297 } 298 299 /** 300 * Request an asynchronous write of count bytes from buffer into 301 * the stream. When the operation is finished callback will be called. 302 * You can then call g_output_stream_write_finish() to get the result of the 303 * operation. 304 * During an async request no other sync and async calls are allowed, 305 * and will result in G_IO_ERROR_PENDING errors. 306 * A value of count larger than G_MAXSSIZE will cause a 307 * G_IO_ERROR_INVALID_ARGUMENT error. 308 * On success, the number of bytes written will be passed to the 309 * callback. It is not an error if this is not the same as the 310 * requested size, as it can happen e.g. on a partial I/O error, 311 * but generally we try to write as many bytes as requested. 312 * You are guaranteed that this method will never fail with 313 * G_IO_ERROR_WOULD_BLOCK - if stream can't accept more data, the 314 * method will just wait until this changes. 315 * Any outstanding I/O request with higher priority (lower numerical 316 * value) will be executed before an outstanding request with lower 317 * priority. Default priority is G_PRIORITY_DEFAULT. 318 * The asyncronous methods have a default fallback that uses threads 319 * to implement asynchronicity, so they are optional for inheriting 320 * classes. However, if you override one you must override all. 321 * For the synchronous, blocking version of this function, see 322 * g_output_stream_write(). 323 * Params: 324 * buffer = the buffer containing the data to write. [array length=count][element-type guint8] 325 * count = the number of bytes to write 326 * ioPriority = the io priority of the request. 327 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 328 * callback = callback to call when the request is satisfied. [scope async] 329 * userData = the data to pass to callback function. [closure] 330 */ 331 public void writeAsync(void* buffer, gsize count, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 332 { 333 // void g_output_stream_write_async (GOutputStream *stream, const void *buffer, gsize count, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 334 g_output_stream_write_async(gOutputStream, buffer, count, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 335 } 336 337 /** 338 * Finishes a stream write operation. 339 * Params: 340 * result = a GAsyncResult. 341 * Returns: a gssize containing the number of bytes written to the stream. 342 * Throws: GException on failure. 343 */ 344 public gssize writeFinish(AsyncResultIF result) 345 { 346 // gssize g_output_stream_write_finish (GOutputStream *stream, GAsyncResult *result, GError **error); 347 GError* err = null; 348 349 auto p = g_output_stream_write_finish(gOutputStream, (result is null) ? null : result.getAsyncResultTStruct(), &err); 350 351 if (err !is null) 352 { 353 throw new GException( new ErrorG(err) ); 354 } 355 356 return p; 357 } 358 359 /** 360 * Splices a stream asynchronously. 361 * When the operation is finished callback will be called. 362 * You can then call g_output_stream_splice_finish() to get the 363 * result of the operation. 364 * For the synchronous, blocking version of this function, see 365 * g_output_stream_splice(). 366 * Params: 367 * source = a GInputStream. 368 * flags = a set of GOutputStreamSpliceFlags. 369 * ioPriority = the io priority of the request. 370 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 371 * callback = a GAsyncReadyCallback. [scope async] 372 * userData = user data passed to callback. [closure] 373 */ 374 public void spliceAsync(InputStream source, GOutputStreamSpliceFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 375 { 376 // void g_output_stream_splice_async (GOutputStream *stream, GInputStream *source, GOutputStreamSpliceFlags flags, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 377 g_output_stream_splice_async(gOutputStream, (source is null) ? null : source.getInputStreamStruct(), flags, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 378 } 379 380 /** 381 * Finishes an asynchronous stream splice operation. 382 * Params: 383 * result = a GAsyncResult. 384 * Returns: a gssize of the number of bytes spliced. Note that if the number of bytes spliced is greater than G_MAXSSIZE, then that will be returned, and there is no way to determine the actual number of bytes spliced. 385 * Throws: GException on failure. 386 */ 387 public gssize spliceFinish(AsyncResultIF result) 388 { 389 // gssize g_output_stream_splice_finish (GOutputStream *stream, GAsyncResult *result, GError **error); 390 GError* err = null; 391 392 auto p = g_output_stream_splice_finish(gOutputStream, (result is null) ? null : result.getAsyncResultTStruct(), &err); 393 394 if (err !is null) 395 { 396 throw new GException( new ErrorG(err) ); 397 } 398 399 return p; 400 } 401 402 /** 403 * Forces an asynchronous write of all user-space buffered data for 404 * the given stream. 405 * For behaviour details see g_output_stream_flush(). 406 * When the operation is finished callback will be 407 * called. You can then call g_output_stream_flush_finish() to get the 408 * result of the operation. 409 * Params: 410 * ioPriority = the io priority of the request. 411 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 412 * callback = a GAsyncReadyCallback to call when the request is satisfied. [scope async] 413 * userData = the data to pass to callback function. [closure] 414 */ 415 public void flushAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 416 { 417 // void g_output_stream_flush_async (GOutputStream *stream, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 418 g_output_stream_flush_async(gOutputStream, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 419 } 420 421 /** 422 * Finishes flushing an output stream. 423 * Params: 424 * result = a GAsyncResult. 425 * Returns: TRUE if flush operation succeeded, FALSE otherwise. 426 * Throws: GException on failure. 427 */ 428 public int flushFinish(AsyncResultIF result) 429 { 430 // gboolean g_output_stream_flush_finish (GOutputStream *stream, GAsyncResult *result, GError **error); 431 GError* err = null; 432 433 auto p = g_output_stream_flush_finish(gOutputStream, (result is null) ? null : result.getAsyncResultTStruct(), &err); 434 435 if (err !is null) 436 { 437 throw new GException( new ErrorG(err) ); 438 } 439 440 return p; 441 } 442 443 /** 444 * Requests an asynchronous close of the stream, releasing resources 445 * related to it. When the operation is finished callback will be 446 * called. You can then call g_output_stream_close_finish() to get 447 * the result of the operation. 448 * For behaviour details see g_output_stream_close(). 449 * The asyncronous methods have a default fallback that uses threads 450 * to implement asynchronicity, so they are optional for inheriting 451 * classes. However, if you override one you must override all. 452 * Params: 453 * ioPriority = the io priority of the request. 454 * cancellable = optional cancellable object. [allow-none] 455 * callback = callback to call when the request is satisfied. [scope async] 456 * userData = the data to pass to callback function. [closure] 457 */ 458 public void closeAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 459 { 460 // void g_output_stream_close_async (GOutputStream *stream, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 461 g_output_stream_close_async(gOutputStream, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 462 } 463 464 /** 465 * Closes an output stream. 466 * Params: 467 * result = a GAsyncResult. 468 * Returns: TRUE if stream was successfully closed, FALSE otherwise. 469 * Throws: GException on failure. 470 */ 471 public int closeFinish(AsyncResultIF result) 472 { 473 // gboolean g_output_stream_close_finish (GOutputStream *stream, GAsyncResult *result, GError **error); 474 GError* err = null; 475 476 auto p = g_output_stream_close_finish(gOutputStream, (result is null) ? null : result.getAsyncResultTStruct(), &err); 477 478 if (err !is null) 479 { 480 throw new GException( new ErrorG(err) ); 481 } 482 483 return p; 484 } 485 486 /** 487 * Checks if an output stream is being closed. This can be 488 * used inside e.g. a flush implementation to see if the 489 * flush (or other i/o operation) is called from within 490 * the closing operation. 491 * Since 2.24 492 * Returns: TRUE if stream is being closed. FALSE otherwise. 493 */ 494 public int isClosing() 495 { 496 // gboolean g_output_stream_is_closing (GOutputStream *stream); 497 return g_output_stream_is_closing(gOutputStream); 498 } 499 500 /** 501 * Checks if an output stream has already been closed. 502 * Returns: TRUE if stream is closed. FALSE otherwise. 503 */ 504 public int isClosed() 505 { 506 // gboolean g_output_stream_is_closed (GOutputStream *stream); 507 return g_output_stream_is_closed(gOutputStream); 508 } 509 510 /** 511 * Checks if an ouput stream has pending actions. 512 * Returns: TRUE if stream has pending actions. 513 */ 514 public int hasPending() 515 { 516 // gboolean g_output_stream_has_pending (GOutputStream *stream); 517 return g_output_stream_has_pending(gOutputStream); 518 } 519 520 /** 521 * Sets stream to have actions pending. If the pending flag is 522 * already set or stream is closed, it will return FALSE and set 523 * error. 524 * Returns: TRUE if pending was previously unset and is now set. 525 * Throws: GException on failure. 526 */ 527 public int setPending() 528 { 529 // gboolean g_output_stream_set_pending (GOutputStream *stream, GError **error); 530 GError* err = null; 531 532 auto p = g_output_stream_set_pending(gOutputStream, &err); 533 534 if (err !is null) 535 { 536 throw new GException( new ErrorG(err) ); 537 } 538 539 return p; 540 } 541 542 /** 543 * Clears the pending flag on stream. 544 */ 545 public void clearPending() 546 { 547 // void g_output_stream_clear_pending (GOutputStream *stream); 548 g_output_stream_clear_pending(gOutputStream); 549 } 550 551 /** 552 * Tries to write the data from bytes into the stream. Will block 553 * during the operation. 554 * If bytes is 0-length, returns 0 and does nothing. A GBytes larger 555 * than G_MAXSSIZE will cause a G_IO_ERROR_INVALID_ARGUMENT error. 556 * On success, the number of bytes written to the stream is returned. 557 * It is not an error if this is not the same as the requested size, as it 558 * can happen e.g. on a partial I/O error, or if there is not enough 559 * storage in the stream. All writes block until at least one byte 560 * is written or an error occurs; 0 is never returned (unless 561 * the size of bytes is 0). 562 * If cancellable is not NULL, then the operation can be cancelled by 563 * triggering the cancellable object from another thread. If the operation 564 * was cancelled, the error G_IO_ERROR_CANCELLED will be returned. If an 565 * operation was partially finished when the operation was cancelled the 566 * partial result will be returned, without an error. 567 * On error -1 is returned and error is set accordingly. 568 * Params: 569 * bytes = the GBytes to write 570 * cancellable = optional cancellable object. [allow-none] 571 * Returns: Number of bytes written, or -1 on error 572 * Throws: GException on failure. 573 */ 574 public gssize writeBytes(Bytes bytes, Cancellable cancellable) 575 { 576 // gssize g_output_stream_write_bytes (GOutputStream *stream, GBytes *bytes, GCancellable *cancellable, GError **error); 577 GError* err = null; 578 579 auto p = g_output_stream_write_bytes(gOutputStream, (bytes is null) ? null : bytes.getBytesStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 580 581 if (err !is null) 582 { 583 throw new GException( new ErrorG(err) ); 584 } 585 586 return p; 587 } 588 589 /** 590 * Request an asynchronous write of the data in bytes to the stream. 591 * When the operation is finished callback will be called. You can 592 * then call g_output_stream_write_bytes_finish() to get the result of 593 * the operation. 594 * During an async request no other sync and async calls are allowed, 595 * and will result in G_IO_ERROR_PENDING errors. 596 * A GBytes larger than G_MAXSSIZE will cause a 597 * G_IO_ERROR_INVALID_ARGUMENT error. 598 * On success, the number of bytes written will be passed to the 599 * callback. It is not an error if this is not the same as the 600 * requested size, as it can happen e.g. on a partial I/O error, 601 * but generally we try to write as many bytes as requested. 602 * You are guaranteed that this method will never fail with 603 * G_IO_ERROR_WOULD_BLOCK - if stream can't accept more data, the 604 * method will just wait until this changes. 605 * Any outstanding I/O request with higher priority (lower numerical 606 * value) will be executed before an outstanding request with lower 607 * priority. Default priority is G_PRIORITY_DEFAULT. 608 * For the synchronous, blocking version of this function, see 609 * g_output_stream_write_bytes(). 610 * Params: 611 * bytes = The bytes to write 612 * ioPriority = the io priority of the request. 613 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 614 * callback = callback to call when the request is satisfied. [scope async] 615 * userData = the data to pass to callback function. [closure] 616 */ 617 public void writeBytesAsync(Bytes bytes, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 618 { 619 // void g_output_stream_write_bytes_async (GOutputStream *stream, GBytes *bytes, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 620 g_output_stream_write_bytes_async(gOutputStream, (bytes is null) ? null : bytes.getBytesStruct(), ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 621 } 622 623 /** 624 * Finishes a stream write-from-GBytes operation. 625 * Params: 626 * result = a GAsyncResult. 627 * Returns: a gssize containing the number of bytes written to the stream. 628 * Throws: GException on failure. 629 */ 630 public gssize writeBytesFinish(AsyncResultIF result) 631 { 632 // gssize g_output_stream_write_bytes_finish (GOutputStream *stream, GAsyncResult *result, GError **error); 633 GError* err = null; 634 635 auto p = g_output_stream_write_bytes_finish(gOutputStream, (result is null) ? null : result.getAsyncResultTStruct(), &err); 636 637 if (err !is null) 638 { 639 throw new GException( new ErrorG(err) ); 640 } 641 642 return p; 643 } 644 }