// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace GLib {

	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.Runtime.InteropServices;
	using static GLib.AbiStructExtension;

#region Autogenerated code
	public partial class FileInputStream : GLib.InputStream, GLib.ISeekable {

		public FileInputStream (IntPtr raw) : base(raw) {}

		protected FileInputStream() : base(IntPtr.Zero)
		{
			CreateNativeObject (Array.Empty<string> (), Array.Empty<GLib.Value> ());
		}

		static TellNativeDelegate Tell_cb_delegate;
		static TellNativeDelegate TellVMCallback {
			get {
				if (Tell_cb_delegate == null)
					Tell_cb_delegate = new TellNativeDelegate (Tell_cb);
				return Tell_cb_delegate;
			}
		}

		static void OverrideTell (GLib.GType gtype)
		{
			OverrideTell (gtype, TellVMCallback);
		}

		static void OverrideTell (GLib.GType gtype, TellNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("tell"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate long TellNativeDelegate (IntPtr inst);

		static long Tell_cb (IntPtr inst)
		{
			try {
				FileInputStream __obj = GLib.Object.GetObject (inst, false) as FileInputStream;
				long __result;
				__result = __obj.OnTell ();
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.FileInputStream), ConnectionMethod="OverrideTell")]
		protected virtual long OnTell ()
		{
			return InternalTell ();
		}

		private long InternalTell ()
		{
			TellNativeDelegate unmanaged = class_abi.BaseOverride<TellNativeDelegate>(this.LookupGType(), "tell");
			if (unmanaged == null) return 0;

			long __result = unmanaged (this.Handle);
			return __result;
		}

		static CanSeekNativeDelegate CanSeek_cb_delegate;
		static CanSeekNativeDelegate CanSeekVMCallback {
			get {
				if (CanSeek_cb_delegate == null)
					CanSeek_cb_delegate = new CanSeekNativeDelegate (CanSeek_cb);
				return CanSeek_cb_delegate;
			}
		}

		static void OverrideCanSeek (GLib.GType gtype)
		{
			OverrideCanSeek (gtype, CanSeekVMCallback);
		}

		static void OverrideCanSeek (GLib.GType gtype, CanSeekNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("can_seek"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool CanSeekNativeDelegate (IntPtr inst);

		static bool CanSeek_cb (IntPtr inst)
		{
			try {
				FileInputStream __obj = GLib.Object.GetObject (inst, false) as FileInputStream;
				bool __result;
				__result = __obj.OnCanSeek ();
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.FileInputStream), ConnectionMethod="OverrideCanSeek")]
		protected virtual bool OnCanSeek ()
		{
			return InternalCanSeek ();
		}

		private bool InternalCanSeek ()
		{
			CanSeekNativeDelegate unmanaged = class_abi.BaseOverride<CanSeekNativeDelegate>(this.LookupGType(), "can_seek");
			if (unmanaged == null) return false;

			bool __result = unmanaged (this.Handle);
			return __result;
		}

		static SeekNativeDelegate Seek_cb_delegate;
		static SeekNativeDelegate SeekVMCallback {
			get {
				if (Seek_cb_delegate == null)
					Seek_cb_delegate = new SeekNativeDelegate (Seek_cb);
				return Seek_cb_delegate;
			}
		}

		static void OverrideSeek (GLib.GType gtype)
		{
			OverrideSeek (gtype, SeekVMCallback);
		}

		static void OverrideSeek (GLib.GType gtype, SeekNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("seek"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool SeekNativeDelegate (IntPtr inst, long offset, int type, IntPtr cancellable, out IntPtr error);

		static bool Seek_cb (IntPtr inst, long offset, int type, IntPtr cancellable, out IntPtr error)
		{
			error = IntPtr.Zero;

			try {
				FileInputStream __obj = GLib.Object.GetObject (inst, false) as FileInputStream;
				bool __result;
				__result = __obj.OnSeek (offset, (GLib.SeekType) type, GLib.Object.GetObject(cancellable) as GLib.Cancellable);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.FileInputStream), ConnectionMethod="OverrideSeek")]
		protected virtual bool OnSeek (long offset, GLib.SeekType type, GLib.Cancellable cancellable)
		{
			return InternalSeek (offset, type, cancellable);
		}

		private bool InternalSeek (long offset, GLib.SeekType type, GLib.Cancellable cancellable)
		{
			SeekNativeDelegate unmanaged = class_abi.BaseOverride<SeekNativeDelegate>(this.LookupGType(), "seek");
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			IntPtr error = IntPtr.Zero;
			bool __result = unmanaged (this.Handle, offset, (int) type, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			return __result;
		}

		static QueryInfoNativeDelegate QueryInfo_cb_delegate;
		static QueryInfoNativeDelegate QueryInfoVMCallback {
			get {
				if (QueryInfo_cb_delegate == null)
					QueryInfo_cb_delegate = new QueryInfoNativeDelegate (QueryInfo_cb);
				return QueryInfo_cb_delegate;
			}
		}

		static void OverrideQueryInfo (GLib.GType gtype)
		{
			OverrideQueryInfo (gtype, QueryInfoVMCallback);
		}

		static void OverrideQueryInfo (GLib.GType gtype, QueryInfoNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("query_info"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr QueryInfoNativeDelegate (IntPtr inst, IntPtr attributes, IntPtr cancellable, out IntPtr error);

		static IntPtr QueryInfo_cb (IntPtr inst, IntPtr attributes, IntPtr cancellable, out IntPtr error)
		{
			error = IntPtr.Zero;

			try {
				FileInputStream __obj = GLib.Object.GetObject (inst, false) as FileInputStream;
				GLib.FileInfo __result;
				__result = __obj.OnQueryInfo (GLib.Marshaller.Utf8PtrToString (attributes), GLib.Object.GetObject(cancellable) as GLib.Cancellable);
				return __result == null ? IntPtr.Zero : __result.Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.FileInputStream), ConnectionMethod="OverrideQueryInfo")]
		protected virtual GLib.FileInfo OnQueryInfo (string attributes, GLib.Cancellable cancellable)
		{
			return InternalQueryInfo (attributes, cancellable);
		}

		private GLib.FileInfo InternalQueryInfo (string attributes, GLib.Cancellable cancellable)
		{
			QueryInfoNativeDelegate unmanaged = class_abi.BaseOverride<QueryInfoNativeDelegate>(this.LookupGType(), "query_info");
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			IntPtr native_attributes = GLib.Marshaller.StringToPtrGStrdup (attributes);
			IntPtr error = IntPtr.Zero;
			IntPtr __result = unmanaged (this.Handle, native_attributes, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.Marshaller.Free (native_attributes);
			return GLib.Object.GetObject(__result) as GLib.FileInfo;
		}

		static QueryInfoAsyncNativeDelegate QueryInfoAsync_cb_delegate;
		static QueryInfoAsyncNativeDelegate QueryInfoAsyncVMCallback {
			get {
				if (QueryInfoAsync_cb_delegate == null)
					QueryInfoAsync_cb_delegate = new QueryInfoAsyncNativeDelegate (QueryInfoAsync_cb);
				return QueryInfoAsync_cb_delegate;
			}
		}

		static void OverrideQueryInfoAsync (GLib.GType gtype)
		{
			OverrideQueryInfoAsync (gtype, QueryInfoAsyncVMCallback);
		}

		static void OverrideQueryInfoAsync (GLib.GType gtype, QueryInfoAsyncNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("query_info_async"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void QueryInfoAsyncNativeDelegate (IntPtr inst, IntPtr attributes, int io_priority, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);

		static void QueryInfoAsync_cb (IntPtr inst, IntPtr attributes, int io_priority, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data)
		{
			try {
				FileInputStream __obj = GLib.Object.GetObject (inst, false) as FileInputStream;
				GLibSharp.AsyncReadyCallbackInvoker cb_invoker = new GLibSharp.AsyncReadyCallbackInvoker (cb, user_data);
				__obj.OnQueryInfoAsync (GLib.Marshaller.Utf8PtrToString (attributes), io_priority, GLib.Object.GetObject(cancellable) as GLib.Cancellable, cb_invoker.Handler);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.FileInputStream), ConnectionMethod="OverrideQueryInfoAsync")]
		protected virtual void OnQueryInfoAsync (string attributes, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			InternalQueryInfoAsync (attributes, io_priority, cancellable, cb);
		}

		private void InternalQueryInfoAsync (string attributes, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			QueryInfoAsyncNativeDelegate unmanaged = class_abi.BaseOverride<QueryInfoAsyncNativeDelegate>(this.LookupGType(), "query_info_async");
			if (unmanaged == null) return;

			IntPtr native_attributes = GLib.Marshaller.StringToPtrGStrdup (attributes);
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			unmanaged (this.Handle, native_attributes, io_priority, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
			GLib.Marshaller.Free (native_attributes);
		}

		static QueryInfoFinishNativeDelegate QueryInfoFinish_cb_delegate;
		static QueryInfoFinishNativeDelegate QueryInfoFinishVMCallback {
			get {
				if (QueryInfoFinish_cb_delegate == null)
					QueryInfoFinish_cb_delegate = new QueryInfoFinishNativeDelegate (QueryInfoFinish_cb);
				return QueryInfoFinish_cb_delegate;
			}
		}

		static void OverrideQueryInfoFinish (GLib.GType gtype)
		{
			OverrideQueryInfoFinish (gtype, QueryInfoFinishVMCallback);
		}

		static void OverrideQueryInfoFinish (GLib.GType gtype, QueryInfoFinishNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("query_info_finish"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr QueryInfoFinishNativeDelegate (IntPtr inst, IntPtr result, out IntPtr error);

		static IntPtr QueryInfoFinish_cb (IntPtr inst, IntPtr result, out IntPtr error)
		{
			error = IntPtr.Zero;

			try {
				FileInputStream __obj = GLib.Object.GetObject (inst, false) as FileInputStream;
				GLib.FileInfo __result;
				__result = __obj.OnQueryInfoFinish (GLib.AsyncResultAdapter.GetObject (result, false));
				return __result == null ? IntPtr.Zero : __result.Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.FileInputStream), ConnectionMethod="OverrideQueryInfoFinish")]
		protected virtual GLib.FileInfo OnQueryInfoFinish (GLib.IAsyncResult result)
		{
			return InternalQueryInfoFinish (result);
		}

		private GLib.FileInfo InternalQueryInfoFinish (GLib.IAsyncResult result)
		{
			QueryInfoFinishNativeDelegate unmanaged = class_abi.BaseOverride<QueryInfoFinishNativeDelegate>(this.LookupGType(), "query_info_finish");
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			IntPtr error = IntPtr.Zero;
			IntPtr __result = unmanaged (this.Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
			return GLib.Object.GetObject(__result) as GLib.FileInfo;
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _class_abi = null;
		static public unsafe new GLib.AbiStruct class_abi {
			get {
				if (_class_abi == null)
					_class_abi = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("tell"
							, GLib.InputStream.class_abi.Fields
							, (uint) sizeof( IntPtr ) // tell
							, null
							, "can_seek"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("can_seek"
							, -1
							, (uint) sizeof( IntPtr ) // can_seek
							, "tell"
							, "seek"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("seek"
							, -1
							, (uint) sizeof( IntPtr ) // seek
							, "can_seek"
							, "query_info"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("query_info"
							, -1
							, (uint) sizeof( IntPtr ) // query_info
							, "seek"
							, "query_info_async"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("query_info_async"
							, -1
							, (uint) sizeof( IntPtr ) // query_info_async
							, "query_info"
							, "query_info_finish"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("query_info_finish"
							, -1
							, (uint) sizeof( IntPtr ) // query_info_finish
							, "query_info_async"
							, "_g_reserved1"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_g_reserved1"
							, -1
							, (uint) sizeof( IntPtr ) // _g_reserved1
							, "query_info_finish"
							, "_g_reserved2"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_g_reserved2"
							, -1
							, (uint) sizeof( IntPtr ) // _g_reserved2
							, "_g_reserved1"
							, "_g_reserved3"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_g_reserved3"
							, -1
							, (uint) sizeof( IntPtr ) // _g_reserved3
							, "_g_reserved2"
							, "_g_reserved4"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_g_reserved4"
							, -1
							, (uint) sizeof( IntPtr ) // _g_reserved4
							, "_g_reserved3"
							, "_g_reserved5"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_g_reserved5"
							, -1
							, (uint) sizeof( IntPtr ) // _g_reserved5
							, "_g_reserved4"
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_file_input_stream_get_type();
		static d_g_file_input_stream_get_type g_file_input_stream_get_type = FuncLoader.LoadFunction<d_g_file_input_stream_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_file_input_stream_get_type"));

		public static new GLib.GType GType { 
			get {
				IntPtr raw_ret = g_file_input_stream_get_type();
				GLib.GType ret = new GLib.GType(raw_ret);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_file_input_stream_query_info(IntPtr raw, IntPtr attributes, IntPtr cancellable, out IntPtr error);
		static d_g_file_input_stream_query_info g_file_input_stream_query_info = FuncLoader.LoadFunction<d_g_file_input_stream_query_info>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_file_input_stream_query_info"));

		public unsafe GLib.FileInfo QueryInfo(string attributes, GLib.Cancellable cancellable) {
			IntPtr native_attributes = GLib.Marshaller.StringToPtrGStrdup (attributes);
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_file_input_stream_query_info(Handle, native_attributes, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.FileInfo ret = GLib.Object.GetObject(raw_ret) as GLib.FileInfo;
			GLib.Marshaller.Free (native_attributes);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_file_input_stream_query_info_async(IntPtr raw, IntPtr attributes, int io_priority, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
		static d_g_file_input_stream_query_info_async g_file_input_stream_query_info_async = FuncLoader.LoadFunction<d_g_file_input_stream_query_info_async>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_file_input_stream_query_info_async"));

		public void QueryInfoAsync(string attributes, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb) {
			IntPtr native_attributes = GLib.Marshaller.StringToPtrGStrdup (attributes);
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			g_file_input_stream_query_info_async(Handle, native_attributes, io_priority, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
			GLib.Marshaller.Free (native_attributes);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_file_input_stream_query_info_finish(IntPtr raw, IntPtr result, out IntPtr error);
		static d_g_file_input_stream_query_info_finish g_file_input_stream_query_info_finish = FuncLoader.LoadFunction<d_g_file_input_stream_query_info_finish>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_file_input_stream_query_info_finish"));

		public unsafe GLib.FileInfo QueryInfoFinish(GLib.IAsyncResult result) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_file_input_stream_query_info_finish(Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
			GLib.FileInfo ret = GLib.Object.GetObject(raw_ret) as GLib.FileInfo;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_g_seekable_can_seek(IntPtr raw);
		static d_g_seekable_can_seek g_seekable_can_seek = FuncLoader.LoadFunction<d_g_seekable_can_seek>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_seekable_can_seek"));

		public bool CanSeek { 
			get {
				bool raw_ret = g_seekable_can_seek(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_g_seekable_can_truncate(IntPtr raw);
		static d_g_seekable_can_truncate g_seekable_can_truncate = FuncLoader.LoadFunction<d_g_seekable_can_truncate>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_seekable_can_truncate"));

		public bool CanTruncate() {
			bool raw_ret = g_seekable_can_truncate(Handle);
			bool ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_g_seekable_seek(IntPtr raw, long offset, int type, IntPtr cancellable, out IntPtr error);
		static d_g_seekable_seek g_seekable_seek = FuncLoader.LoadFunction<d_g_seekable_seek>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_seekable_seek"));

		public bool Seek(long offset, GLib.SeekType type, GLib.Cancellable cancellable) {
			IntPtr error = IntPtr.Zero;
			bool raw_ret = g_seekable_seek(Handle, offset, (int) type, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			bool ret = raw_ret;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate long d_g_seekable_tell(IntPtr raw);
		static d_g_seekable_tell g_seekable_tell = FuncLoader.LoadFunction<d_g_seekable_tell>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_seekable_tell"));

		public long Position { 
			get {
				long raw_ret = g_seekable_tell(Handle);
				long ret = raw_ret;
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_g_seekable_truncate(IntPtr raw, long offset, IntPtr cancellable, out IntPtr error);
		static d_g_seekable_truncate g_seekable_truncate = FuncLoader.LoadFunction<d_g_seekable_truncate>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_seekable_truncate"));

		public bool Truncate(long offset, GLib.Cancellable cancellable) {
			IntPtr error = IntPtr.Zero;
			bool raw_ret = g_seekable_truncate(Handle, offset, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			bool ret = raw_ret;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public unsafe new GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("priv"
							, GLib.InputStream.abi_info.Fields
							, (uint) sizeof( IntPtr ) // priv
							, null
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
