1// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gio
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/glib"
12 "github.com/bnema/puregotk/v4/gobject/types"
13)
14
15type DataInputStreamClass struct {
16 _ structs.HostLayout
17
18 ParentClass BufferedInputStreamClass
19
20 xGReserved1 uintptr
21
22 xGReserved2 uintptr
23
24 xGReserved3 uintptr
25
26 xGReserved4 uintptr
27
28 xGReserved5 uintptr
29}
30
31func (x *DataInputStreamClass) GoPointer() uintptr {
32 return uintptr(unsafe.Pointer(x))
33}
34
35// OverrideGReserved1 sets the "_g_reserved1" callback function.
36func (x *DataInputStreamClass) OverrideGReserved1(cb func()) {
37 if cb == nil {
38 x.xGReserved1 = 0
39 } else {
40 x.xGReserved1 = purego.NewCallback(func() {
41 cb()
42 })
43 }
44}
45
46// GetGReserved1 gets the "_g_reserved1" callback function.
47func (x *DataInputStreamClass) GetGReserved1() func() {
48 if x.xGReserved1 == 0 {
49 return nil
50 }
51 var rawCallback func()
52 purego.RegisterFunc(&rawCallback, x.xGReserved1)
53 return func() {
54 rawCallback()
55 }
56}
57
58// OverrideGReserved2 sets the "_g_reserved2" callback function.
59func (x *DataInputStreamClass) OverrideGReserved2(cb func()) {
60 if cb == nil {
61 x.xGReserved2 = 0
62 } else {
63 x.xGReserved2 = purego.NewCallback(func() {
64 cb()
65 })
66 }
67}
68
69// GetGReserved2 gets the "_g_reserved2" callback function.
70func (x *DataInputStreamClass) GetGReserved2() func() {
71 if x.xGReserved2 == 0 {
72 return nil
73 }
74 var rawCallback func()
75 purego.RegisterFunc(&rawCallback, x.xGReserved2)
76 return func() {
77 rawCallback()
78 }
79}
80
81// OverrideGReserved3 sets the "_g_reserved3" callback function.
82func (x *DataInputStreamClass) OverrideGReserved3(cb func()) {
83 if cb == nil {
84 x.xGReserved3 = 0
85 } else {
86 x.xGReserved3 = purego.NewCallback(func() {
87 cb()
88 })
89 }
90}
91
92// GetGReserved3 gets the "_g_reserved3" callback function.
93func (x *DataInputStreamClass) GetGReserved3() func() {
94 if x.xGReserved3 == 0 {
95 return nil
96 }
97 var rawCallback func()
98 purego.RegisterFunc(&rawCallback, x.xGReserved3)
99 return func() {
100 rawCallback()
101 }
102}
103
104// OverrideGReserved4 sets the "_g_reserved4" callback function.
105func (x *DataInputStreamClass) OverrideGReserved4(cb func()) {
106 if cb == nil {
107 x.xGReserved4 = 0
108 } else {
109 x.xGReserved4 = purego.NewCallback(func() {
110 cb()
111 })
112 }
113}
114
115// GetGReserved4 gets the "_g_reserved4" callback function.
116func (x *DataInputStreamClass) GetGReserved4() func() {
117 if x.xGReserved4 == 0 {
118 return nil
119 }
120 var rawCallback func()
121 purego.RegisterFunc(&rawCallback, x.xGReserved4)
122 return func() {
123 rawCallback()
124 }
125}
126
127// OverrideGReserved5 sets the "_g_reserved5" callback function.
128func (x *DataInputStreamClass) OverrideGReserved5(cb func()) {
129 if cb == nil {
130 x.xGReserved5 = 0
131 } else {
132 x.xGReserved5 = purego.NewCallback(func() {
133 cb()
134 })
135 }
136}
137
138// GetGReserved5 gets the "_g_reserved5" callback function.
139func (x *DataInputStreamClass) GetGReserved5() func() {
140 if x.xGReserved5 == 0 {
141 return nil
142 }
143 var rawCallback func()
144 purego.RegisterFunc(&rawCallback, x.xGReserved5)
145 return func() {
146 rawCallback()
147 }
148}
149
150type DataInputStreamPrivate struct {
151 _ structs.HostLayout
152}
153
154func (x *DataInputStreamPrivate) GoPointer() uintptr {
155 return uintptr(unsafe.Pointer(x))
156}
157
158// Data input stream implements [class@Gio.InputStream] and includes functions
159// for reading structured data directly from a binary input stream.
160type DataInputStream struct {
161 BufferedInputStream
162}
163
164var xDataInputStreamGLibType func() types.GType
165
166func DataInputStreamGLibType() types.GType {
167 return xDataInputStreamGLibType()
168}
169
170func DataInputStreamNewFromInternalPtr(ptr uintptr) *DataInputStream {
171 cls := &DataInputStream{}
172 cls.Ptr = ptr
173 return cls
174}
175
176var xNewDataInputStream func(uintptr) uintptr
177
178// Creates a new data input stream for the @base_stream.
179func NewDataInputStream(BaseStreamVar *InputStream) *DataInputStream {
180 var cls *DataInputStream
181
182 cret := xNewDataInputStream(BaseStreamVar.GoPointer())
183
184 if cret == 0 {
185 return nil
186 }
187 cls = &DataInputStream{}
188 cls.Ptr = cret
189 return cls
190}
191
192var xDataInputStreamGetByteOrder func(uintptr) DataStreamByteOrder
193
194// Gets the byte order for the data input stream.
195func (x *DataInputStream) GetByteOrder() DataStreamByteOrder {
196
197 cret := xDataInputStreamGetByteOrder(x.GoPointer())
198 return cret
199}
200
201var xDataInputStreamGetNewlineType func(uintptr) DataStreamNewlineType
202
203// Gets the current newline type for the @stream.
204func (x *DataInputStream) GetNewlineType() DataStreamNewlineType {
205
206 cret := xDataInputStreamGetNewlineType(x.GoPointer())
207 return cret
208}
209
210var xDataInputStreamReadByte func(uintptr, uintptr, **glib.Error) byte
211
212// Reads an unsigned 8-bit/1-byte value from @stream.
213func (x *DataInputStream) ReadByte(CancellableVar *Cancellable) (byte, error) {
214 var cerr *glib.Error
215
216 cret := xDataInputStreamReadByte(x.GoPointer(), CancellableVar.GoPointer(), &cerr)
217 if cerr == nil {
218 return cret, nil
219 }
220 return cret, cerr
221
222}
223
224var xDataInputStreamReadInt16 func(uintptr, uintptr, **glib.Error) int16
225
226// Reads a 16-bit/2-byte value from @stream.
227//
228// In order to get the correct byte order for this read operation,
229// see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
230func (x *DataInputStream) ReadInt16(CancellableVar *Cancellable) (int16, error) {
231 var cerr *glib.Error
232
233 cret := xDataInputStreamReadInt16(x.GoPointer(), CancellableVar.GoPointer(), &cerr)
234 if cerr == nil {
235 return cret, nil
236 }
237 return cret, cerr
238
239}
240
241var xDataInputStreamReadInt32 func(uintptr, uintptr, **glib.Error) int32
242
243// Reads a signed 32-bit/4-byte value from @stream.
244//
245// In order to get the correct byte order for this read operation,
246// see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
247//
248// If @cancellable is not %NULL, then the operation can be cancelled by
249// triggering the cancellable object from another thread. If the operation
250// was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
251func (x *DataInputStream) ReadInt32(CancellableVar *Cancellable) (int32, error) {
252 var cerr *glib.Error
253
254 cret := xDataInputStreamReadInt32(x.GoPointer(), CancellableVar.GoPointer(), &cerr)
255 if cerr == nil {
256 return cret, nil
257 }
258 return cret, cerr
259
260}
261
262var xDataInputStreamReadInt64 func(uintptr, uintptr, **glib.Error) int64
263
264// Reads a 64-bit/8-byte value from @stream.
265//
266// In order to get the correct byte order for this read operation,
267// see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
268//
269// If @cancellable is not %NULL, then the operation can be cancelled by
270// triggering the cancellable object from another thread. If the operation
271// was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
272func (x *DataInputStream) ReadInt64(CancellableVar *Cancellable) (int64, error) {
273 var cerr *glib.Error
274
275 cret := xDataInputStreamReadInt64(x.GoPointer(), CancellableVar.GoPointer(), &cerr)
276 if cerr == nil {
277 return cret, nil
278 }
279 return cret, cerr
280
281}
282
283var xDataInputStreamReadLine func(uintptr, *uint, uintptr, **glib.Error) uintptr
284
285// Reads a line from the data input stream. Note that no encoding
286// checks or conversion is performed; the input is not guaranteed to
287// be UTF-8, and may in fact have embedded NUL characters.
288//
289// If @cancellable is not %NULL, then the operation can be cancelled by
290// triggering the cancellable object from another thread. If the operation
291// was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
292func (x *DataInputStream) ReadLine(LengthVar *uint, CancellableVar *Cancellable) (uintptr, error) {
293 var cerr *glib.Error
294
295 cret := xDataInputStreamReadLine(x.GoPointer(), LengthVar, CancellableVar.GoPointer(), &cerr)
296 if cerr == nil {
297 return cret, nil
298 }
299 return cret, cerr
300
301}
302
303var xDataInputStreamReadLineAsync func(uintptr, int, uintptr, uintptr, uintptr)
304
305// The asynchronous version of g_data_input_stream_read_line(). It is
306// an error to have two outstanding calls to this function.
307//
308// When the operation is finished, @callback will be called. You
309// can then call g_data_input_stream_read_line_finish() to get
310// the result of the operation.
311func (x *DataInputStream) ReadLineAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
312
313 var CallbackVarRef uintptr
314 if CallbackVar != nil {
315 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
316 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
317 CallbackVarRef = cbRefPtr
318 } else {
319 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
320 cbFn := *CallbackVar
321 cbFn(arg0, arg1, arg2)
322 }
323 CallbackVarRef = purego.NewCallback(fcb)
324 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
325 }
326 }
327
328 xDataInputStreamReadLineAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
329
330}
331
332var xDataInputStreamReadLineFinish func(uintptr, uintptr, *uint, **glib.Error) uintptr
333
334// Finish an asynchronous call started by
335// g_data_input_stream_read_line_async(). Note the warning about
336// string encoding in g_data_input_stream_read_line() applies here as
337// well.
338func (x *DataInputStream) ReadLineFinish(ResultVar AsyncResult, LengthVar *uint) (uintptr, error) {
339 var cerr *glib.Error
340
341 cret := xDataInputStreamReadLineFinish(x.GoPointer(), ResultVar.GoPointer(), LengthVar, &cerr)
342 if cerr == nil {
343 return cret, nil
344 }
345 return cret, cerr
346
347}
348
349var xDataInputStreamReadLineFinishUtf8 func(uintptr, uintptr, *uint, **glib.Error) string
350
351// Finish an asynchronous call started by
352// g_data_input_stream_read_line_async().
353func (x *DataInputStream) ReadLineFinishUtf8(ResultVar AsyncResult, LengthVar *uint) (string, error) {
354 var cerr *glib.Error
355
356 cret := xDataInputStreamReadLineFinishUtf8(x.GoPointer(), ResultVar.GoPointer(), LengthVar, &cerr)
357 if cerr == nil {
358 return cret, nil
359 }
360 return cret, cerr
361
362}
363
364var xDataInputStreamReadLineUtf8 func(uintptr, *uint, uintptr, **glib.Error) string
365
366// Reads a UTF-8 encoded line from the data input stream.
367//
368// If @cancellable is not %NULL, then the operation can be cancelled by
369// triggering the cancellable object from another thread. If the operation
370// was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
371func (x *DataInputStream) ReadLineUtf8(LengthVar *uint, CancellableVar *Cancellable) (string, error) {
372 var cerr *glib.Error
373
374 cret := xDataInputStreamReadLineUtf8(x.GoPointer(), LengthVar, CancellableVar.GoPointer(), &cerr)
375 if cerr == nil {
376 return cret, nil
377 }
378 return cret, cerr
379
380}
381
382var xDataInputStreamReadUint16 func(uintptr, uintptr, **glib.Error) uint16
383
384// Reads an unsigned 16-bit/2-byte value from @stream.
385//
386// In order to get the correct byte order for this read operation,
387// see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
388func (x *DataInputStream) ReadUint16(CancellableVar *Cancellable) (uint16, error) {
389 var cerr *glib.Error
390
391 cret := xDataInputStreamReadUint16(x.GoPointer(), CancellableVar.GoPointer(), &cerr)
392 if cerr == nil {
393 return cret, nil
394 }
395 return cret, cerr
396
397}
398
399var xDataInputStreamReadUint32 func(uintptr, uintptr, **glib.Error) uint32
400
401// Reads an unsigned 32-bit/4-byte value from @stream.
402//
403// In order to get the correct byte order for this read operation,
404// see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
405//
406// If @cancellable is not %NULL, then the operation can be cancelled by
407// triggering the cancellable object from another thread. If the operation
408// was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
409func (x *DataInputStream) ReadUint32(CancellableVar *Cancellable) (uint32, error) {
410 var cerr *glib.Error
411
412 cret := xDataInputStreamReadUint32(x.GoPointer(), CancellableVar.GoPointer(), &cerr)
413 if cerr == nil {
414 return cret, nil
415 }
416 return cret, cerr
417
418}
419
420var xDataInputStreamReadUint64 func(uintptr, uintptr, **glib.Error) uint64
421
422// Reads an unsigned 64-bit/8-byte value from @stream.
423//
424// In order to get the correct byte order for this read operation,
425// see g_data_input_stream_get_byte_order().
426//
427// If @cancellable is not %NULL, then the operation can be cancelled by
428// triggering the cancellable object from another thread. If the operation
429// was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
430func (x *DataInputStream) ReadUint64(CancellableVar *Cancellable) (uint64, error) {
431 var cerr *glib.Error
432
433 cret := xDataInputStreamReadUint64(x.GoPointer(), CancellableVar.GoPointer(), &cerr)
434 if cerr == nil {
435 return cret, nil
436 }
437 return cret, cerr
438
439}
440
441var xDataInputStreamReadUntil func(uintptr, string, *uint, uintptr, **glib.Error) string
442
443// Reads a string from the data input stream, up to the first
444// occurrence of any of the stop characters.
445//
446// Note that, in contrast to g_data_input_stream_read_until_async(),
447// this function consumes the stop character that it finds.
448//
449// Don't use this function in new code. Its functionality is
450// inconsistent with g_data_input_stream_read_until_async(). Both
451// functions will be marked as deprecated in a future release. Use
452// g_data_input_stream_read_upto() instead, but note that that function
453// does not consume the stop character.
454func (x *DataInputStream) ReadUntil(StopCharsVar string, LengthVar *uint, CancellableVar *Cancellable) (string, error) {
455 var cerr *glib.Error
456
457 cret := xDataInputStreamReadUntil(x.GoPointer(), StopCharsVar, LengthVar, CancellableVar.GoPointer(), &cerr)
458 if cerr == nil {
459 return cret, nil
460 }
461 return cret, cerr
462
463}
464
465var xDataInputStreamReadUntilAsync func(uintptr, string, int, uintptr, uintptr, uintptr)
466
467// The asynchronous version of g_data_input_stream_read_until().
468// It is an error to have two outstanding calls to this function.
469//
470// Note that, in contrast to g_data_input_stream_read_until(),
471// this function does not consume the stop character that it finds. You
472// must read it for yourself.
473//
474// When the operation is finished, @callback will be called. You
475// can then call g_data_input_stream_read_until_finish() to get
476// the result of the operation.
477//
478// Don't use this function in new code. Its functionality is
479// inconsistent with g_data_input_stream_read_until(). Both functions
480// will be marked as deprecated in a future release. Use
481// g_data_input_stream_read_upto_async() instead.
482func (x *DataInputStream) ReadUntilAsync(StopCharsVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
483
484 var CallbackVarRef uintptr
485 if CallbackVar != nil {
486 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
487 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
488 CallbackVarRef = cbRefPtr
489 } else {
490 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
491 cbFn := *CallbackVar
492 cbFn(arg0, arg1, arg2)
493 }
494 CallbackVarRef = purego.NewCallback(fcb)
495 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
496 }
497 }
498
499 xDataInputStreamReadUntilAsync(x.GoPointer(), StopCharsVar, IoPriorityVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
500
501}
502
503var xDataInputStreamReadUntilFinish func(uintptr, uintptr, *uint, **glib.Error) string
504
505// Finish an asynchronous call started by
506// g_data_input_stream_read_until_async().
507func (x *DataInputStream) ReadUntilFinish(ResultVar AsyncResult, LengthVar *uint) (string, error) {
508 var cerr *glib.Error
509
510 cret := xDataInputStreamReadUntilFinish(x.GoPointer(), ResultVar.GoPointer(), LengthVar, &cerr)
511 if cerr == nil {
512 return cret, nil
513 }
514 return cret, cerr
515
516}
517
518var xDataInputStreamReadUpto func(uintptr, string, int, *uint, uintptr, **glib.Error) string
519
520// Reads a string from the data input stream, up to the first
521// occurrence of any of the stop characters.
522//
523// In contrast to g_data_input_stream_read_until(), this function
524// does not consume the stop character. You have to use
525// g_data_input_stream_read_byte() to get it before calling
526// g_data_input_stream_read_upto() again.
527//
528// Note that @stop_chars may contain '\0' if @stop_chars_len is
529// specified.
530//
531// The returned string will always be nul-terminated on success.
532func (x *DataInputStream) ReadUpto(StopCharsVar string, StopCharsLenVar int, LengthVar *uint, CancellableVar *Cancellable) (string, error) {
533 var cerr *glib.Error
534
535 cret := xDataInputStreamReadUpto(x.GoPointer(), StopCharsVar, StopCharsLenVar, LengthVar, CancellableVar.GoPointer(), &cerr)
536 if cerr == nil {
537 return cret, nil
538 }
539 return cret, cerr
540
541}
542
543var xDataInputStreamReadUptoAsync func(uintptr, string, int, int, uintptr, uintptr, uintptr)
544
545// The asynchronous version of g_data_input_stream_read_upto().
546// It is an error to have two outstanding calls to this function.
547//
548// In contrast to g_data_input_stream_read_until(), this function
549// does not consume the stop character. You have to use
550// g_data_input_stream_read_byte() to get it before calling
551// g_data_input_stream_read_upto() again.
552//
553// Note that @stop_chars may contain '\0' if @stop_chars_len is
554// specified.
555//
556// When the operation is finished, @callback will be called. You
557// can then call g_data_input_stream_read_upto_finish() to get
558// the result of the operation.
559func (x *DataInputStream) ReadUptoAsync(StopCharsVar string, StopCharsLenVar int, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
560
561 var CallbackVarRef uintptr
562 if CallbackVar != nil {
563 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
564 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
565 CallbackVarRef = cbRefPtr
566 } else {
567 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
568 cbFn := *CallbackVar
569 cbFn(arg0, arg1, arg2)
570 }
571 CallbackVarRef = purego.NewCallback(fcb)
572 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
573 }
574 }
575
576 xDataInputStreamReadUptoAsync(x.GoPointer(), StopCharsVar, StopCharsLenVar, IoPriorityVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
577
578}
579
580var xDataInputStreamReadUptoFinish func(uintptr, uintptr, *uint, **glib.Error) string
581
582// Finish an asynchronous call started by
583// g_data_input_stream_read_upto_async().
584//
585// Note that this function does not consume the stop character. You
586// have to use g_data_input_stream_read_byte() to get it before calling
587// g_data_input_stream_read_upto_async() again.
588//
589// The returned string will always be nul-terminated on success.
590func (x *DataInputStream) ReadUptoFinish(ResultVar AsyncResult, LengthVar *uint) (string, error) {
591 var cerr *glib.Error
592
593 cret := xDataInputStreamReadUptoFinish(x.GoPointer(), ResultVar.GoPointer(), LengthVar, &cerr)
594 if cerr == nil {
595 return cret, nil
596 }
597 return cret, cerr
598
599}
600
601var xDataInputStreamSetByteOrder func(uintptr, DataStreamByteOrder)
602
603// This function sets the byte order for the given @stream. All subsequent
604// reads from the @stream will be read in the given @order.
605func (x *DataInputStream) SetByteOrder(OrderVar DataStreamByteOrder) {
606
607 xDataInputStreamSetByteOrder(x.GoPointer(), OrderVar)
608
609}
610
611var xDataInputStreamSetNewlineType func(uintptr, DataStreamNewlineType)
612
613// Sets the newline type for the @stream.
614//
615// Note that using G_DATA_STREAM_NEWLINE_TYPE_ANY is slightly unsafe. If a read
616// chunk ends in "CR" we must read an additional byte to know if this is "CR" or
617// "CR LF", and this might block if there is no more data available.
618func (x *DataInputStream) SetNewlineType(TypeVar DataStreamNewlineType) {
619
620 xDataInputStreamSetNewlineType(x.GoPointer(), TypeVar)
621
622}
623
624func (c *DataInputStream) GoPointer() uintptr {
625 if c == nil {
626 return 0
627 }
628 return c.Ptr
629}
630
631func (c *DataInputStream) SetGoPointer(ptr uintptr) {
632 c.Ptr = ptr
633}
634
635// Tests if the stream supports the #GSeekableIface.
636func (x *DataInputStream) CanSeek() bool {
637
638 cret := XGSeekableCanSeek(x.GoPointer())
639 return cret
640}
641
642// Tests if the length of the stream can be adjusted with
643// g_seekable_truncate().
644func (x *DataInputStream) CanTruncate() bool {
645
646 cret := XGSeekableCanTruncate(x.GoPointer())
647 return cret
648}
649
650// Seeks in the stream by the given @offset, modified by @type.
651//
652// Attempting to seek past the end of the stream will have different
653// results depending on if the stream is fixed-sized or resizable. If
654// the stream is resizable then seeking past the end and then writing
655// will result in zeros filling the empty space. Seeking past the end
656// of a resizable stream and reading will result in EOF. Seeking past
657// the end of a fixed-sized stream will fail.
658//
659// Any operation that would result in a negative offset will fail.
660//
661// If @cancellable is not %NULL, then the operation can be cancelled by
662// triggering the cancellable object from another thread. If the operation
663// was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
664func (x *DataInputStream) Seek(OffsetVar int64, TypeVar glib.SeekType, CancellableVar *Cancellable) (bool, error) {
665 var cerr *glib.Error
666
667 cret := XGSeekableSeek(x.GoPointer(), OffsetVar, TypeVar, CancellableVar.GoPointer(), &cerr)
668 if cerr == nil {
669 return cret, nil
670 }
671 return cret, cerr
672
673}
674
675// Tells the current position within the stream.
676func (x *DataInputStream) Tell() int64 {
677
678 cret := XGSeekableTell(x.GoPointer())
679 return cret
680}
681
682// Sets the length of the stream to @offset. If the stream was previously
683// larger than @offset, the extra data is discarded. If the stream was
684// previously shorter than @offset, it is extended with NUL ('\0') bytes.
685//
686// If @cancellable is not %NULL, then the operation can be cancelled by
687// triggering the cancellable object from another thread. If the operation
688// was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
689// operation was partially finished when the operation was cancelled the
690// partial result will be returned, without an error.
691func (x *DataInputStream) Truncate(OffsetVar int64, CancellableVar *Cancellable) (bool, error) {
692 var cerr *glib.Error
693
694 cret := XGSeekableTruncate(x.GoPointer(), OffsetVar, CancellableVar.GoPointer(), &cerr)
695 if cerr == nil {
696 return cret, nil
697 }
698 return cret, cerr
699
700}
701
702func init() {
703 core.SetPackageName("GIO", "gio-2.0")
704 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
705 var libs []uintptr
706 for _, libPath := range core.GetPaths("GIO") {
707 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
708 if err != nil {
709 panic(err)
710 }
711 libs = append(libs, lib)
712 }
713
714 core.PuregoSafeRegister(&xDataInputStreamGLibType, libs, "g_data_input_stream_get_type")
715
716 core.PuregoSafeRegister(&xNewDataInputStream, libs, "g_data_input_stream_new")
717
718 core.PuregoSafeRegister(&xDataInputStreamGetByteOrder, libs, "g_data_input_stream_get_byte_order")
719 core.PuregoSafeRegister(&xDataInputStreamGetNewlineType, libs, "g_data_input_stream_get_newline_type")
720 core.PuregoSafeRegister(&xDataInputStreamReadByte, libs, "g_data_input_stream_read_byte")
721 core.PuregoSafeRegister(&xDataInputStreamReadInt16, libs, "g_data_input_stream_read_int16")
722 core.PuregoSafeRegister(&xDataInputStreamReadInt32, libs, "g_data_input_stream_read_int32")
723 core.PuregoSafeRegister(&xDataInputStreamReadInt64, libs, "g_data_input_stream_read_int64")
724 core.PuregoSafeRegister(&xDataInputStreamReadLine, libs, "g_data_input_stream_read_line")
725 core.PuregoSafeRegister(&xDataInputStreamReadLineAsync, libs, "g_data_input_stream_read_line_async")
726 core.PuregoSafeRegister(&xDataInputStreamReadLineFinish, libs, "g_data_input_stream_read_line_finish")
727 core.PuregoSafeRegister(&xDataInputStreamReadLineFinishUtf8, libs, "g_data_input_stream_read_line_finish_utf8")
728 core.PuregoSafeRegister(&xDataInputStreamReadLineUtf8, libs, "g_data_input_stream_read_line_utf8")
729 core.PuregoSafeRegister(&xDataInputStreamReadUint16, libs, "g_data_input_stream_read_uint16")
730 core.PuregoSafeRegister(&xDataInputStreamReadUint32, libs, "g_data_input_stream_read_uint32")
731 core.PuregoSafeRegister(&xDataInputStreamReadUint64, libs, "g_data_input_stream_read_uint64")
732 core.PuregoSafeRegister(&xDataInputStreamReadUntil, libs, "g_data_input_stream_read_until")
733 core.PuregoSafeRegister(&xDataInputStreamReadUntilAsync, libs, "g_data_input_stream_read_until_async")
734 core.PuregoSafeRegister(&xDataInputStreamReadUntilFinish, libs, "g_data_input_stream_read_until_finish")
735 core.PuregoSafeRegister(&xDataInputStreamReadUpto, libs, "g_data_input_stream_read_upto")
736 core.PuregoSafeRegister(&xDataInputStreamReadUptoAsync, libs, "g_data_input_stream_read_upto_async")
737 core.PuregoSafeRegister(&xDataInputStreamReadUptoFinish, libs, "g_data_input_stream_read_upto_finish")
738 core.PuregoSafeRegister(&xDataInputStreamSetByteOrder, libs, "g_data_input_stream_set_byte_order")
739 core.PuregoSafeRegister(&xDataInputStreamSetNewlineType, libs, "g_data_input_stream_set_newline_type")
740
741}