source: appstream-generator/build/girepo/gio/OutputStream.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 24.9 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gio.OutputStream;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.AsyncResultIF;
26private import gio.Cancellable;
27private import gio.InputStream;
28private import glib.Bytes;
29private import glib.ErrorG;
30private import glib.GException;
31private import glib.Str;
32private import gobject.ObjectG;
33
34
35/**
36 * #GOutputStream has functions to write to a stream (g_output_stream_write()),
37 * to close a stream (g_output_stream_close()) and to flush pending writes
38 * (g_output_stream_flush()).
39 *
40 * To copy the content of an input stream to an output stream without
41 * manually handling the reads and writes, use g_output_stream_splice().
42 *
43 * All of these functions have async variants too.
44 */
45public class OutputStream : ObjectG
46{
47        /** the main Gtk struct */
48        protected GOutputStream* gOutputStream;
49
50        /** Get the main Gtk struct */
51        public GOutputStream* getOutputStreamStruct()
52        {
53                return gOutputStream;
54        }
55
56        /** the main Gtk struct as a void* */
57        protected override void* getStruct()
58        {
59                return cast(void*)gOutputStream;
60        }
61
62        protected override void setStruct(GObject* obj)
63        {
64                gOutputStream = cast(GOutputStream*)obj;
65                super.setStruct(obj);
66        }
67
68        /**
69         * Sets our main struct and passes it to the parent class.
70         */
71        public this (GOutputStream* gOutputStream, bool ownedRef = false)
72        {
73                this.gOutputStream = gOutputStream;
74                super(cast(GObject*)gOutputStream, ownedRef);
75        }
76
77
78        /** */
79        public static GType getType()
80        {
81                return g_output_stream_get_type();
82        }
83
84        /**
85         * Clears the pending flag on @stream.
86         */
87        public void clearPending()
88        {
89                g_output_stream_clear_pending(gOutputStream);
90        }
91
92        /**
93         * Closes the stream, releasing resources related to it.
94         *
95         * Once the stream is closed, all other operations will return %G_IO_ERROR_CLOSED.
96         * Closing a stream multiple times will not return an error.
97         *
98         * Closing a stream will automatically flush any outstanding buffers in the
99         * stream.
100         *
101         * Streams will be automatically closed when the last reference
102         * is dropped, but you might want to call this function to make sure
103         * resources are released as early as possible.
104         *
105         * Some streams might keep the backing store of the stream (e.g. a file descriptor)
106         * open after the stream is closed. See the documentation for the individual
107         * stream for details.
108         *
109         * On failure the first error that happened will be reported, but the close
110         * operation will finish as much as possible. A stream that failed to
111         * close will still return %G_IO_ERROR_CLOSED for all operations. Still, it
112         * is important to check and report the error to the user, otherwise
113         * there might be a loss of data as all data might not be written.
114         *
115         * If @cancellable is not %NULL, then the operation can be cancelled by
116         * triggering the cancellable object from another thread. If the operation
117         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
118         * Cancelling a close will still leave the stream closed, but there some streams
119         * can use a faster close that doesn't block to e.g. check errors. On
120         * cancellation (as with any error) there is no guarantee that all written
121         * data will reach the target.
122         *
123         * Params:
124         *     cancellable = optional cancellable object
125         *
126         * Returns: %TRUE on success, %FALSE on failure
127         *
128         * Throws: GException on failure.
129         */
130        public bool close(Cancellable cancellable)
131        {
132                GError* err = null;
133               
134                auto p = g_output_stream_close(gOutputStream, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
135               
136                if (err !is null)
137                {
138                        throw new GException( new ErrorG(err) );
139                }
140               
141                return p;
142        }
143
144        /**
145         * Requests an asynchronous close of the stream, releasing resources
146         * related to it. When the operation is finished @callback will be
147         * called. You can then call g_output_stream_close_finish() to get
148         * the result of the operation.
149         *
150         * For behaviour details see g_output_stream_close().
151         *
152         * The asyncronous methods have a default fallback that uses threads
153         * to implement asynchronicity, so they are optional for inheriting
154         * classes. However, if you override one you must override all.
155         *
156         * Params:
157         *     ioPriority = the io priority of the request.
158         *     cancellable = optional cancellable object
159         *     callback = callback to call when the request is satisfied
160         *     userData = the data to pass to callback function
161         */
162        public void closeAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
163        {
164                g_output_stream_close_async(gOutputStream, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
165        }
166
167        /**
168         * Closes an output stream.
169         *
170         * Params:
171         *     result = a #GAsyncResult.
172         *
173         * Returns: %TRUE if stream was successfully closed, %FALSE otherwise.
174         *
175         * Throws: GException on failure.
176         */
177        public bool closeFinish(AsyncResultIF result)
178        {
179                GError* err = null;
180               
181                auto p = g_output_stream_close_finish(gOutputStream, (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
182               
183                if (err !is null)
184                {
185                        throw new GException( new ErrorG(err) );
186                }
187               
188                return p;
189        }
190
191        /**
192         * Forces a write of all user-space buffered data for the given
193         * @stream. Will block during the operation. Closing the stream will
194         * implicitly cause a flush.
195         *
196         * This function is optional for inherited classes.
197         *
198         * If @cancellable is not %NULL, then the operation can be cancelled by
199         * triggering the cancellable object from another thread. If the operation
200         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
201         *
202         * Params:
203         *     cancellable = optional cancellable object
204         *
205         * Returns: %TRUE on success, %FALSE on error
206         *
207         * Throws: GException on failure.
208         */
209        public bool flush(Cancellable cancellable)
210        {
211                GError* err = null;
212               
213                auto p = g_output_stream_flush(gOutputStream, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
214               
215                if (err !is null)
216                {
217                        throw new GException( new ErrorG(err) );
218                }
219               
220                return p;
221        }
222
223        /**
224         * Forces an asynchronous write of all user-space buffered data for
225         * the given @stream.
226         * For behaviour details see g_output_stream_flush().
227         *
228         * When the operation is finished @callback will be
229         * called. You can then call g_output_stream_flush_finish() to get the
230         * result of the operation.
231         *
232         * Params:
233         *     ioPriority = the io priority of the request.
234         *     cancellable = optional #GCancellable object, %NULL to ignore.
235         *     callback = a #GAsyncReadyCallback to call when the request is satisfied
236         *     userData = the data to pass to callback function
237         */
238        public void flushAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
239        {
240                g_output_stream_flush_async(gOutputStream, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
241        }
242
243        /**
244         * Finishes flushing an output stream.
245         *
246         * Params:
247         *     result = a GAsyncResult.
248         *
249         * Returns: %TRUE if flush operation succeeded, %FALSE otherwise.
250         *
251         * Throws: GException on failure.
252         */
253        public bool flushFinish(AsyncResultIF result)
254        {
255                GError* err = null;
256               
257                auto p = g_output_stream_flush_finish(gOutputStream, (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
258               
259                if (err !is null)
260                {
261                        throw new GException( new ErrorG(err) );
262                }
263               
264                return p;
265        }
266
267        /**
268         * Checks if an ouput stream has pending actions.
269         *
270         * Returns: %TRUE if @stream has pending actions.
271         */
272        public bool hasPending()
273        {
274                return g_output_stream_has_pending(gOutputStream) != 0;
275        }
276
277        /**
278         * Checks if an output stream has already been closed.
279         *
280         * Returns: %TRUE if @stream is closed. %FALSE otherwise.
281         */
282        public bool isClosed()
283        {
284                return g_output_stream_is_closed(gOutputStream) != 0;
285        }
286
287        /**
288         * Checks if an output stream is being closed. This can be
289         * used inside e.g. a flush implementation to see if the
290         * flush (or other i/o operation) is called from within
291         * the closing operation.
292         *
293         * Returns: %TRUE if @stream is being closed. %FALSE otherwise.
294         *
295         * Since: 2.24
296         */
297        public bool isClosing()
298        {
299                return g_output_stream_is_closing(gOutputStream) != 0;
300        }
301
302        /**
303         * Sets @stream to have actions pending. If the pending flag is
304         * already set or @stream is closed, it will return %FALSE and set
305         * @error.
306         *
307         * Returns: %TRUE if pending was previously unset and is now set.
308         *
309         * Throws: GException on failure.
310         */
311        public bool setPending()
312        {
313                GError* err = null;
314               
315                auto p = g_output_stream_set_pending(gOutputStream, &err) != 0;
316               
317                if (err !is null)
318                {
319                        throw new GException( new ErrorG(err) );
320                }
321               
322                return p;
323        }
324
325        /**
326         * Splices an input stream into an output stream.
327         *
328         * Params:
329         *     source = a #GInputStream.
330         *     flags = a set of #GOutputStreamSpliceFlags.
331         *     cancellable = optional #GCancellable object, %NULL to ignore.
332         *
333         * Returns: a #gssize containing the size of the data spliced, or
334         *     -1 if an error occurred. Note that if the number of bytes
335         *     spliced is greater than %G_MAXSSIZE, then that will be
336         *     returned, and there is no way to determine the actual number
337         *     of bytes spliced.
338         *
339         * Throws: GException on failure.
340         */
341        public ptrdiff_t splice(InputStream source, GOutputStreamSpliceFlags flags, Cancellable cancellable)
342        {
343                GError* err = null;
344               
345                auto p = g_output_stream_splice(gOutputStream, (source is null) ? null : source.getInputStreamStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
346               
347                if (err !is null)
348                {
349                        throw new GException( new ErrorG(err) );
350                }
351               
352                return p;
353        }
354
355        /**
356         * Splices a stream asynchronously.
357         * When the operation is finished @callback will be called.
358         * You can then call g_output_stream_splice_finish() to get the
359         * result of the operation.
360         *
361         * For the synchronous, blocking version of this function, see
362         * g_output_stream_splice().
363         *
364         * Params:
365         *     source = a #GInputStream.
366         *     flags = a set of #GOutputStreamSpliceFlags.
367         *     ioPriority = the io priority of the request.
368         *     cancellable = optional #GCancellable object, %NULL to ignore.
369         *     callback = a #GAsyncReadyCallback.
370         *     userData = user data passed to @callback.
371         */
372        public void spliceAsync(InputStream source, GOutputStreamSpliceFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
373        {
374                g_output_stream_splice_async(gOutputStream, (source is null) ? null : source.getInputStreamStruct(), flags, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
375        }
376
377        /**
378         * Finishes an asynchronous stream splice operation.
379         *
380         * Params:
381         *     result = a #GAsyncResult.
382         *
383         * Returns: a #gssize of the number of bytes spliced. Note that if the
384         *     number of bytes spliced is greater than %G_MAXSSIZE, then that
385         *     will be returned, and there is no way to determine the actual
386         *     number of bytes spliced.
387         *
388         * Throws: GException on failure.
389         */
390        public ptrdiff_t spliceFinish(AsyncResultIF result)
391        {
392                GError* err = null;
393               
394                auto p = g_output_stream_splice_finish(gOutputStream, (result is null) ? null : result.getAsyncResultStruct(), &err);
395               
396                if (err !is null)
397                {
398                        throw new GException( new ErrorG(err) );
399                }
400               
401                return p;
402        }
403
404        /**
405         * This is a utility function around g_output_stream_write_all(). It
406         * uses g_strdup_vprintf() to turn @format and @args into a string that
407         * is then written to @stream.
408         *
409         * See the documentation of g_output_stream_write_all() about the
410         * behavior of the actual write operation.
411         *
412         * Note that partial writes cannot be properly checked with this
413         * function due to the variable length of the written string, if you
414         * need precise control over partial write failures, you need to
415         * create you own printf()-like wrapper around g_output_stream_write()
416         * or g_output_stream_write_all().
417         *
418         * Params:
419         *     bytesWritten = location to store the number of bytes that was
420         *         written to the stream
421         *     cancellable = optional #GCancellable object, %NULL to ignore.
422         *     error = location to store the error occurring, or %NULL to ignore
423         *     format = the format string. See the printf() documentation
424         *     args = the parameters to insert into the format string
425         *
426         * Returns: %TRUE on success, %FALSE if there was an error
427         *
428         * Since: 2.40
429         */
430        public bool vprintf(out size_t bytesWritten, Cancellable cancellable, out ErrorG error, string format, void* args)
431        {
432                GError* outerror = null;
433               
434                auto p = g_output_stream_vprintf(gOutputStream, &bytesWritten, (cancellable is null) ? null : cancellable.getCancellableStruct(), &outerror, Str.toStringz(format), args) != 0;
435               
436                error = new ErrorG(outerror);
437               
438                return p;
439        }
440
441        /**
442         * Tries to write @count bytes from @buffer into the stream. Will block
443         * during the operation.
444         *
445         * If count is 0, returns 0 and does nothing. A value of @count
446         * larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
447         *
448         * On success, the number of bytes written to the stream is returned.
449         * It is not an error if this is not the same as the requested size, as it
450         * can happen e.g. on a partial I/O error, or if there is not enough
451         * storage in the stream. All writes block until at least one byte
452         * is written or an error occurs; 0 is never returned (unless
453         * @count is 0).
454         *
455         * If @cancellable is not %NULL, then the operation can be cancelled by
456         * triggering the cancellable object from another thread. If the operation
457         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
458         * operation was partially finished when the operation was cancelled the
459         * partial result will be returned, without an error.
460         *
461         * On error -1 is returned and @error is set accordingly.
462         *
463         * Params:
464         *     buffer = the buffer containing the data to write.
465         *     count = the number of bytes to write
466         *     cancellable = optional cancellable object
467         *
468         * Returns: Number of bytes written, or -1 on error
469         *
470         * Throws: GException on failure.
471         */
472        public ptrdiff_t write(ubyte[] buffer, Cancellable cancellable)
473        {
474                GError* err = null;
475               
476                auto p = g_output_stream_write(gOutputStream, buffer.ptr, cast(size_t)buffer.length, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
477               
478                if (err !is null)
479                {
480                        throw new GException( new ErrorG(err) );
481                }
482               
483                return p;
484        }
485
486        /**
487         * Tries to write @count bytes from @buffer into the stream. Will block
488         * during the operation.
489         *
490         * This function is similar to g_output_stream_write(), except it tries to
491         * write as many bytes as requested, only stopping on an error.
492         *
493         * On a successful write of @count bytes, %TRUE is returned, and @bytes_written
494         * is set to @count.
495         *
496         * If there is an error during the operation %FALSE is returned and @error
497         * is set to indicate the error status.
498         *
499         * As a special exception to the normal conventions for functions that
500         * use #GError, if this function returns %FALSE (and sets @error) then
501         * @bytes_written will be set to the number of bytes that were
502         * successfully written before the error was encountered.  This
503         * functionality is only available from C.  If you need it from another
504         * language then you must write your own loop around
505         * g_output_stream_write().
506         *
507         * Params:
508         *     buffer = the buffer containing the data to write.
509         *     count = the number of bytes to write
510         *     bytesWritten = location to store the number of bytes that was
511         *         written to the stream
512         *     cancellable = optional #GCancellable object, %NULL to ignore.
513         *
514         * Returns: %TRUE on success, %FALSE if there was an error
515         *
516         * Throws: GException on failure.
517         */
518        public bool writeAll(ubyte[] buffer, out size_t bytesWritten, Cancellable cancellable)
519        {
520                GError* err = null;
521               
522                auto p = g_output_stream_write_all(gOutputStream, buffer.ptr, cast(size_t)buffer.length, &bytesWritten, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
523               
524                if (err !is null)
525                {
526                        throw new GException( new ErrorG(err) );
527                }
528               
529                return p;
530        }
531
532        /**
533         * Request an asynchronous write of @count bytes from @buffer into
534         * the stream. When the operation is finished @callback will be called.
535         * You can then call g_output_stream_write_all_finish() to get the result of the
536         * operation.
537         *
538         * This is the asynchronous version of g_output_stream_write_all().
539         *
540         * Call g_output_stream_write_all_finish() to collect the result.
541         *
542         * Any outstanding I/O request with higher priority (lower numerical
543         * value) will be executed before an outstanding request with lower
544         * priority. Default priority is %G_PRIORITY_DEFAULT.
545         *
546         * Note that no copy of @buffer will be made, so it must stay valid
547         * until @callback is called.
548         *
549         * Params:
550         *     buffer = the buffer containing the data to write
551         *     count = the number of bytes to write
552         *     ioPriority = the io priority of the request
553         *     cancellable = optional #GCancellable object, %NULL to ignore
554         *     callback = callback to call when the request is satisfied
555         *     userData = the data to pass to callback function
556         *
557         * Since: 2.44
558         */
559        public void writeAllAsync(ubyte[] buffer, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
560        {
561                g_output_stream_write_all_async(gOutputStream, buffer.ptr, cast(size_t)buffer.length, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
562        }
563
564        /**
565         * Finishes an asynchronous stream write operation started with
566         * g_output_stream_write_all_async().
567         *
568         * As a special exception to the normal conventions for functions that
569         * use #GError, if this function returns %FALSE (and sets @error) then
570         * @bytes_written will be set to the number of bytes that were
571         * successfully written before the error was encountered.  This
572         * functionality is only available from C.  If you need it from another
573         * language then you must write your own loop around
574         * g_output_stream_write_async().
575         *
576         * Params:
577         *     result = a #GAsyncResult
578         *     bytesWritten = location to store the number of bytes that was written to the stream
579         *
580         * Returns: %TRUE on success, %FALSE if there was an error
581         *
582         * Since: 2.44
583         *
584         * Throws: GException on failure.
585         */
586        public bool writeAllFinish(AsyncResultIF result, out size_t bytesWritten)
587        {
588                GError* err = null;
589               
590                auto p = g_output_stream_write_all_finish(gOutputStream, (result is null) ? null : result.getAsyncResultStruct(), &bytesWritten, &err) != 0;
591               
592                if (err !is null)
593                {
594                        throw new GException( new ErrorG(err) );
595                }
596               
597                return p;
598        }
599
600        /**
601         * Request an asynchronous write of @count bytes from @buffer into
602         * the stream. When the operation is finished @callback will be called.
603         * You can then call g_output_stream_write_finish() to get the result of the
604         * operation.
605         *
606         * During an async request no other sync and async calls are allowed,
607         * and will result in %G_IO_ERROR_PENDING errors.
608         *
609         * A value of @count larger than %G_MAXSSIZE will cause a
610         * %G_IO_ERROR_INVALID_ARGUMENT error.
611         *
612         * On success, the number of bytes written will be passed to the
613         * @callback. It is not an error if this is not the same as the
614         * requested size, as it can happen e.g. on a partial I/O error,
615         * but generally we try to write as many bytes as requested.
616         *
617         * You are guaranteed that this method will never fail with
618         * %G_IO_ERROR_WOULD_BLOCK - if @stream can't accept more data, the
619         * method will just wait until this changes.
620         *
621         * Any outstanding I/O request with higher priority (lower numerical
622         * value) will be executed before an outstanding request with lower
623         * priority. Default priority is %G_PRIORITY_DEFAULT.
624         *
625         * The asyncronous methods have a default fallback that uses threads
626         * to implement asynchronicity, so they are optional for inheriting
627         * classes. However, if you override one you must override all.
628         *
629         * For the synchronous, blocking version of this function, see
630         * g_output_stream_write().
631         *
632         * Note that no copy of @buffer will be made, so it must stay valid
633         * until @callback is called. See g_output_stream_write_bytes_async()
634         * for a #GBytes version that will automatically hold a reference to
635         * the contents (without copying) for the duration of the call.
636         *
637         * Params:
638         *     buffer = the buffer containing the data to write.
639         *     count = the number of bytes to write
640         *     ioPriority = the io priority of the request.
641         *     cancellable = optional #GCancellable object, %NULL to ignore.
642         *     callback = callback to call when the request is satisfied
643         *     userData = the data to pass to callback function
644         */
645        public void writeAsync(ubyte[] buffer, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
646        {
647                g_output_stream_write_async(gOutputStream, buffer.ptr, cast(size_t)buffer.length, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
648        }
649
650        /**
651         * A wrapper function for g_output_stream_write() which takes a
652         * #GBytes as input.  This can be more convenient for use by language
653         * bindings or in other cases where the refcounted nature of #GBytes
654         * is helpful over a bare pointer interface.
655         *
656         * However, note that this function may still perform partial writes,
657         * just like g_output_stream_write().  If that occurs, to continue
658         * writing, you will need to create a new #GBytes containing just the
659         * remaining bytes, using g_bytes_new_from_bytes(). Passing the same
660         * #GBytes instance multiple times potentially can result in duplicated
661         * data in the output stream.
662         *
663         * Params:
664         *     bytes = the #GBytes to write
665         *     cancellable = optional cancellable object
666         *
667         * Returns: Number of bytes written, or -1 on error
668         *
669         * Throws: GException on failure.
670         */
671        public ptrdiff_t writeBytes(Bytes bytes, Cancellable cancellable)
672        {
673                GError* err = null;
674               
675                auto p = g_output_stream_write_bytes(gOutputStream, (bytes is null) ? null : bytes.getBytesStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
676               
677                if (err !is null)
678                {
679                        throw new GException( new ErrorG(err) );
680                }
681               
682                return p;
683        }
684
685        /**
686         * This function is similar to g_output_stream_write_async(), but
687         * takes a #GBytes as input.  Due to the refcounted nature of #GBytes,
688         * this allows the stream to avoid taking a copy of the data.
689         *
690         * However, note that this function may still perform partial writes,
691         * just like g_output_stream_write_async(). If that occurs, to continue
692         * writing, you will need to create a new #GBytes containing just the
693         * remaining bytes, using g_bytes_new_from_bytes(). Passing the same
694         * #GBytes instance multiple times potentially can result in duplicated
695         * data in the output stream.
696         *
697         * For the synchronous, blocking version of this function, see
698         * g_output_stream_write_bytes().
699         *
700         * Params:
701         *     bytes = The bytes to write
702         *     ioPriority = the io priority of the request.
703         *     cancellable = optional #GCancellable object, %NULL to ignore.
704         *     callback = callback to call when the request is satisfied
705         *     userData = the data to pass to callback function
706         */
707        public void writeBytesAsync(Bytes bytes, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
708        {
709                g_output_stream_write_bytes_async(gOutputStream, (bytes is null) ? null : bytes.getBytesStruct(), ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
710        }
711
712        /**
713         * Finishes a stream write-from-#GBytes operation.
714         *
715         * Params:
716         *     result = a #GAsyncResult.
717         *
718         * Returns: a #gssize containing the number of bytes written to the stream.
719         *
720         * Throws: GException on failure.
721         */
722        public ptrdiff_t writeBytesFinish(AsyncResultIF result)
723        {
724                GError* err = null;
725               
726                auto p = g_output_stream_write_bytes_finish(gOutputStream, (result is null) ? null : result.getAsyncResultStruct(), &err);
727               
728                if (err !is null)
729                {
730                        throw new GException( new ErrorG(err) );
731                }
732               
733                return p;
734        }
735
736        /**
737         * Finishes a stream write operation.
738         *
739         * Params:
740         *     result = a #GAsyncResult.
741         *
742         * Returns: a #gssize containing the number of bytes written to the stream.
743         *
744         * Throws: GException on failure.
745         */
746        public ptrdiff_t writeFinish(AsyncResultIF result)
747        {
748                GError* err = null;
749               
750                auto p = g_output_stream_write_finish(gOutputStream, (result is null) ? null : result.getAsyncResultStruct(), &err);
751               
752                if (err !is null)
753                {
754                        throw new GException( new ErrorG(err) );
755                }
756               
757                return p;
758        }
759}
Note: See TracBrowser for help on using the repository browser.