{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- t'GI.Gio.Objects.InputStream.InputStream' has functions to read from a stream ('GI.Gio.Objects.InputStream.inputStreamRead'),
-- to close a stream ('GI.Gio.Objects.InputStream.inputStreamClose') and to skip some content
-- ('GI.Gio.Objects.InputStream.inputStreamSkip').
-- 
-- To copy the content of an input stream to an output stream without
-- manually handling the reads and writes, use 'GI.Gio.Objects.OutputStream.outputStreamSplice'.
-- 
-- See the documentation for t'GI.Gio.Objects.IOStream.IOStream' for details of thread safety of
-- streaming APIs.
-- 
-- All of these functions have async variants too.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Gio.Objects.InputStream
    ( 

-- * Exported types
    InputStream(..)                         ,
    IsInputStream                           ,
    toInputStream                           ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [clearPending]("GI.Gio.Objects.InputStream#g:method:clearPending"), [close]("GI.Gio.Objects.InputStream#g:method:close"), [closeAsync]("GI.Gio.Objects.InputStream#g:method:closeAsync"), [closeFinish]("GI.Gio.Objects.InputStream#g:method:closeFinish"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [hasPending]("GI.Gio.Objects.InputStream#g:method:hasPending"), [isClosed]("GI.Gio.Objects.InputStream#g:method:isClosed"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [read]("GI.Gio.Objects.InputStream#g:method:read"), [readAll]("GI.Gio.Objects.InputStream#g:method:readAll"), [readAllAsync]("GI.Gio.Objects.InputStream#g:method:readAllAsync"), [readAllFinish]("GI.Gio.Objects.InputStream#g:method:readAllFinish"), [readAsync]("GI.Gio.Objects.InputStream#g:method:readAsync"), [readBytes]("GI.Gio.Objects.InputStream#g:method:readBytes"), [readBytesAsync]("GI.Gio.Objects.InputStream#g:method:readBytesAsync"), [readBytesFinish]("GI.Gio.Objects.InputStream#g:method:readBytesFinish"), [readFinish]("GI.Gio.Objects.InputStream#g:method:readFinish"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [skip]("GI.Gio.Objects.InputStream#g:method:skip"), [skipAsync]("GI.Gio.Objects.InputStream#g:method:skipAsync"), [skipFinish]("GI.Gio.Objects.InputStream#g:method:skipFinish"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setPending]("GI.Gio.Objects.InputStream#g:method:setPending"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveInputStreamMethod                ,
#endif

-- ** clearPending #method:clearPending#

#if defined(ENABLE_OVERLOADING)
    InputStreamClearPendingMethodInfo       ,
#endif
    inputStreamClearPending                 ,


-- ** close #method:close#

#if defined(ENABLE_OVERLOADING)
    InputStreamCloseMethodInfo              ,
#endif
    inputStreamClose                        ,


-- ** closeAsync #method:closeAsync#

#if defined(ENABLE_OVERLOADING)
    InputStreamCloseAsyncMethodInfo         ,
#endif
    inputStreamCloseAsync                   ,


-- ** closeFinish #method:closeFinish#

#if defined(ENABLE_OVERLOADING)
    InputStreamCloseFinishMethodInfo        ,
#endif
    inputStreamCloseFinish                  ,


-- ** hasPending #method:hasPending#

#if defined(ENABLE_OVERLOADING)
    InputStreamHasPendingMethodInfo         ,
#endif
    inputStreamHasPending                   ,


-- ** isClosed #method:isClosed#

#if defined(ENABLE_OVERLOADING)
    InputStreamIsClosedMethodInfo           ,
#endif
    inputStreamIsClosed                     ,


-- ** read #method:read#

#if defined(ENABLE_OVERLOADING)
    InputStreamReadMethodInfo               ,
#endif
    inputStreamRead                         ,


-- ** readAll #method:readAll#

#if defined(ENABLE_OVERLOADING)
    InputStreamReadAllMethodInfo            ,
#endif
    inputStreamReadAll                      ,


-- ** readAllAsync #method:readAllAsync#

#if defined(ENABLE_OVERLOADING)
    InputStreamReadAllAsyncMethodInfo       ,
#endif
    inputStreamReadAllAsync                 ,


-- ** readAllFinish #method:readAllFinish#

#if defined(ENABLE_OVERLOADING)
    InputStreamReadAllFinishMethodInfo      ,
#endif
    inputStreamReadAllFinish                ,


-- ** readAsync #method:readAsync#

#if defined(ENABLE_OVERLOADING)
    InputStreamReadAsyncMethodInfo          ,
#endif
    inputStreamReadAsync                    ,


-- ** readBytes #method:readBytes#

#if defined(ENABLE_OVERLOADING)
    InputStreamReadBytesMethodInfo          ,
#endif
    inputStreamReadBytes                    ,


-- ** readBytesAsync #method:readBytesAsync#

#if defined(ENABLE_OVERLOADING)
    InputStreamReadBytesAsyncMethodInfo     ,
#endif
    inputStreamReadBytesAsync               ,


-- ** readBytesFinish #method:readBytesFinish#

#if defined(ENABLE_OVERLOADING)
    InputStreamReadBytesFinishMethodInfo    ,
#endif
    inputStreamReadBytesFinish              ,


-- ** readFinish #method:readFinish#

#if defined(ENABLE_OVERLOADING)
    InputStreamReadFinishMethodInfo         ,
#endif
    inputStreamReadFinish                   ,


-- ** setPending #method:setPending#

#if defined(ENABLE_OVERLOADING)
    InputStreamSetPendingMethodInfo         ,
#endif
    inputStreamSetPending                   ,


-- ** skip #method:skip#

#if defined(ENABLE_OVERLOADING)
    InputStreamSkipMethodInfo               ,
#endif
    inputStreamSkip                         ,


-- ** skipAsync #method:skipAsync#

#if defined(ENABLE_OVERLOADING)
    InputStreamSkipAsyncMethodInfo          ,
#endif
    inputStreamSkipAsync                    ,


-- ** skipFinish #method:skipFinish#

#if defined(ENABLE_OVERLOADING)
    InputStreamSkipFinishMethodInfo         ,
#endif
    inputStreamSkipFinish                   ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R

import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable

-- | Memory-managed wrapper type.
newtype InputStream = InputStream (SP.ManagedPtr InputStream)
    deriving (InputStream -> InputStream -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputStream -> InputStream -> Bool
$c/= :: InputStream -> InputStream -> Bool
== :: InputStream -> InputStream -> Bool
$c== :: InputStream -> InputStream -> Bool
Eq)

instance SP.ManagedPtrNewtype InputStream where
    toManagedPtr :: InputStream -> ManagedPtr InputStream
toManagedPtr (InputStream ManagedPtr InputStream
p) = ManagedPtr InputStream
p

foreign import ccall "g_input_stream_get_type"
    c_g_input_stream_get_type :: IO B.Types.GType

instance B.Types.TypedObject InputStream where
    glibType :: IO GType
glibType = IO GType
c_g_input_stream_get_type

instance B.Types.GObject InputStream

-- | Type class for types which can be safely cast to `InputStream`, for instance with `toInputStream`.
class (SP.GObject o, O.IsDescendantOf InputStream o) => IsInputStream o
instance (SP.GObject o, O.IsDescendantOf InputStream o) => IsInputStream o

instance O.HasParentTypes InputStream
type instance O.ParentTypes InputStream = '[GObject.Object.Object]

-- | Cast to `InputStream`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toInputStream :: (MIO.MonadIO m, IsInputStream o) => o -> m InputStream
toInputStream :: forall (m :: * -> *) o.
(MonadIO m, IsInputStream o) =>
o -> m InputStream
toInputStream = forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr InputStream -> InputStream
InputStream

-- | Convert 'InputStream' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe InputStream) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_input_stream_get_type
    gvalueSet_ :: Ptr GValue -> Maybe InputStream -> IO ()
gvalueSet_ Ptr GValue
gv Maybe InputStream
P.Nothing = forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (forall a. Ptr a
FP.nullPtr :: FP.Ptr InputStream)
    gvalueSet_ Ptr GValue
gv (P.Just InputStream
obj) = forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr InputStream
obj (forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe InputStream)
gvalueGet_ Ptr GValue
gv = do
        Ptr InputStream
ptr <- forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr InputStream)
        if Ptr InputStream
ptr forall a. Eq a => a -> a -> Bool
/= forall a. Ptr a
FP.nullPtr
        then forall a. a -> Maybe a
P.Just forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr InputStream -> InputStream
InputStream Ptr InputStream
ptr
        else forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveInputStreamMethod (t :: Symbol) (o :: *) :: * where
    ResolveInputStreamMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveInputStreamMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveInputStreamMethod "clearPending" o = InputStreamClearPendingMethodInfo
    ResolveInputStreamMethod "close" o = InputStreamCloseMethodInfo
    ResolveInputStreamMethod "closeAsync" o = InputStreamCloseAsyncMethodInfo
    ResolveInputStreamMethod "closeFinish" o = InputStreamCloseFinishMethodInfo
    ResolveInputStreamMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveInputStreamMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveInputStreamMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveInputStreamMethod "hasPending" o = InputStreamHasPendingMethodInfo
    ResolveInputStreamMethod "isClosed" o = InputStreamIsClosedMethodInfo
    ResolveInputStreamMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveInputStreamMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveInputStreamMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveInputStreamMethod "read" o = InputStreamReadMethodInfo
    ResolveInputStreamMethod "readAll" o = InputStreamReadAllMethodInfo
    ResolveInputStreamMethod "readAllAsync" o = InputStreamReadAllAsyncMethodInfo
    ResolveInputStreamMethod "readAllFinish" o = InputStreamReadAllFinishMethodInfo
    ResolveInputStreamMethod "readAsync" o = InputStreamReadAsyncMethodInfo
    ResolveInputStreamMethod "readBytes" o = InputStreamReadBytesMethodInfo
    ResolveInputStreamMethod "readBytesAsync" o = InputStreamReadBytesAsyncMethodInfo
    ResolveInputStreamMethod "readBytesFinish" o = InputStreamReadBytesFinishMethodInfo
    ResolveInputStreamMethod "readFinish" o = InputStreamReadFinishMethodInfo
    ResolveInputStreamMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveInputStreamMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveInputStreamMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveInputStreamMethod "skip" o = InputStreamSkipMethodInfo
    ResolveInputStreamMethod "skipAsync" o = InputStreamSkipAsyncMethodInfo
    ResolveInputStreamMethod "skipFinish" o = InputStreamSkipFinishMethodInfo
    ResolveInputStreamMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveInputStreamMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveInputStreamMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveInputStreamMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveInputStreamMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveInputStreamMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveInputStreamMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveInputStreamMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveInputStreamMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveInputStreamMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveInputStreamMethod "setPending" o = InputStreamSetPendingMethodInfo
    ResolveInputStreamMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveInputStreamMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveInputStreamMethod t InputStream, O.OverloadedMethod info InputStream p) => OL.IsLabel t (InputStream -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveInputStreamMethod t InputStream, O.OverloadedMethod info InputStream p, R.HasField t InputStream p) => R.HasField t InputStream p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveInputStreamMethod t InputStream, O.OverloadedMethodInfo info InputStream) => OL.IsLabel t (O.MethodProxy info InputStream) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList InputStream
type instance O.AttributeList InputStream = InputStreamAttributeList
type InputStreamAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList InputStream = InputStreamSignalList
type InputStreamSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method InputStream::clear_pending
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "input stream" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_input_stream_clear_pending" g_input_stream_clear_pending :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    IO ()

-- | Clears the pending flag on /@stream@/.
inputStreamClearPending ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a) =>
    a
    -- ^ /@stream@/: input stream
    -> m ()
inputStreamClearPending :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsInputStream a) =>
a -> m ()
inputStreamClearPending a
stream = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr InputStream -> IO ()
g_input_stream_clear_pending Ptr InputStream
stream'
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
    forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data InputStreamClearPendingMethodInfo
instance (signature ~ (m ()), MonadIO m, IsInputStream a) => O.OverloadedMethod InputStreamClearPendingMethodInfo a signature where
    overloadedMethod = inputStreamClearPending

instance O.OverloadedMethodInfo InputStreamClearPendingMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamClearPending",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamClearPending"
        })


#endif

-- method InputStream::close
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GInputStream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "optional #GCancellable object, %NULL to ignore."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_input_stream_close" g_input_stream_close :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Closes the stream, releasing resources related to it.
-- 
-- Once the stream is closed, all other operations will return 'GI.Gio.Enums.IOErrorEnumClosed'.
-- Closing a stream multiple times will not return an error.
-- 
-- Streams will be automatically closed when the last reference
-- is dropped, but you might want to call this function to make sure
-- resources are released as early as possible.
-- 
-- Some streams might keep the backing store of the stream (e.g. a file descriptor)
-- open after the stream is closed. See the documentation for the individual
-- stream for details.
-- 
-- On failure the first error that happened will be reported, but the close
-- operation will finish as much as possible. A stream that failed to
-- close will still return 'GI.Gio.Enums.IOErrorEnumClosed' for all operations. Still, it
-- is important to check and report the error to the user.
-- 
-- If /@cancellable@/ is not 'P.Nothing', then the operation can be cancelled by
-- triggering the cancellable object from another thread. If the operation
-- was cancelled, the error 'GI.Gio.Enums.IOErrorEnumCancelled' will be returned.
-- Cancelling a close will still leave the stream closed, but some streams
-- can use a faster close that doesn\'t block to e.g. check errors.
inputStreamClose ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@stream@/: A t'GI.Gio.Objects.InputStream.InputStream'.
    -> Maybe (b)
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
inputStreamClose :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) =>
a -> Maybe b -> m ()
inputStreamClose a
stream Maybe b
cancellable = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr InputStream -> Ptr Cancellable -> Ptr (Ptr GError) -> IO CInt
g_input_stream_close Ptr InputStream
stream' Ptr Cancellable
maybeCancellable
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
        forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data InputStreamCloseMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod InputStreamCloseMethodInfo a signature where
    overloadedMethod = inputStreamClose

instance O.OverloadedMethodInfo InputStreamCloseMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamClose",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamClose"
        })


#endif

-- method InputStream::close_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GInputStream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "io_priority"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the [I/O priority][io-priority] of the request"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "optional cancellable object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "callback to call when the request is satisfied"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data to pass to callback function"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_input_stream_close_async" g_input_stream_close_async :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Int32 ->                                -- io_priority : TBasicType TInt
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Requests an asynchronous closes of the stream, releasing resources related to it.
-- When the operation is finished /@callback@/ will be called.
-- You can then call 'GI.Gio.Objects.InputStream.inputStreamCloseFinish' to get the result of the
-- operation.
-- 
-- For behaviour details see 'GI.Gio.Objects.InputStream.inputStreamClose'.
-- 
-- The asynchronous methods have a default fallback that uses threads to implement
-- asynchronicity, so they are optional for inheriting classes. However, if you
-- override one you must override all.
inputStreamCloseAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@stream@/: A t'GI.Gio.Objects.InputStream.InputStream'.
    -> Int32
    -- ^ /@ioPriority@/: the [I\/O priority][io-priority] of the request
    -> Maybe (b)
    -- ^ /@cancellable@/: optional cancellable object
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: callback to call when the request is satisfied
    -> m ()
inputStreamCloseAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) =>
a -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
inputStreamCloseAsync a
stream Int32
ioPriority Maybe b
cancellable Maybe AsyncReadyCallback
callback = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return (forall a b. Ptr a -> FunPtr b
castPtrToFunPtr forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = forall a. Ptr a
nullPtr
    Ptr InputStream
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_input_stream_close_async Ptr InputStream
stream' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback forall a. Ptr a
userData
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
    forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data InputStreamCloseAsyncMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod InputStreamCloseAsyncMethodInfo a signature where
    overloadedMethod = inputStreamCloseAsync

instance O.OverloadedMethodInfo InputStreamCloseAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamCloseAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamCloseAsync"
        })


#endif

-- method InputStream::close_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GInputStream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GAsyncResult." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_input_stream_close_finish" g_input_stream_close_finish :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Finishes closing a stream asynchronously, started from 'GI.Gio.Objects.InputStream.inputStreamCloseAsync'.
inputStreamCloseFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@stream@/: a t'GI.Gio.Objects.InputStream.InputStream'.
    -> b
    -- ^ /@result@/: a t'GI.Gio.Interfaces.AsyncResult.AsyncResult'.
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
inputStreamCloseFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsAsyncResult b) =>
a -> b -> m ()
inputStreamCloseFinish a
stream b
result_ = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr AsyncResult
result_' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr InputStream -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_input_stream_close_finish Ptr InputStream
stream' Ptr AsyncResult
result_'
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data InputStreamCloseFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsInputStream a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod InputStreamCloseFinishMethodInfo a signature where
    overloadedMethod = inputStreamCloseFinish

instance O.OverloadedMethodInfo InputStreamCloseFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamCloseFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamCloseFinish"
        })


#endif

-- method InputStream::has_pending
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "input stream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_input_stream_has_pending" g_input_stream_has_pending :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    IO CInt

-- | Checks if an input stream has pending actions.
inputStreamHasPending ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a) =>
    a
    -- ^ /@stream@/: input stream.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@stream@/ has pending actions.
inputStreamHasPending :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsInputStream a) =>
a -> m Bool
inputStreamHasPending a
stream = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    CInt
result <- Ptr InputStream -> IO CInt
g_input_stream_has_pending Ptr InputStream
stream'
    let result' :: Bool
result' = (forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
    forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data InputStreamHasPendingMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsInputStream a) => O.OverloadedMethod InputStreamHasPendingMethodInfo a signature where
    overloadedMethod = inputStreamHasPending

instance O.OverloadedMethodInfo InputStreamHasPendingMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamHasPending",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamHasPending"
        })


#endif

-- method InputStream::is_closed
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "input stream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_input_stream_is_closed" g_input_stream_is_closed :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    IO CInt

-- | Checks if an input stream is closed.
inputStreamIsClosed ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a) =>
    a
    -- ^ /@stream@/: input stream.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the stream is closed.
inputStreamIsClosed :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsInputStream a) =>
a -> m Bool
inputStreamIsClosed a
stream = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    CInt
result <- Ptr InputStream -> IO CInt
g_input_stream_is_closed Ptr InputStream
stream'
    let result' :: Bool
result' = (forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
    forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data InputStreamIsClosedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsInputStream a) => O.OverloadedMethod InputStreamIsClosedMethodInfo a signature where
    overloadedMethod = inputStreamIsClosed

instance O.OverloadedMethodInfo InputStreamIsClosedMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamIsClosed",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamIsClosed"
        })


#endif

-- method InputStream::read
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GInputStream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buffer"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "\n    a buffer to read data into (which should be at least count bytes long)."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt32
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the number of bytes that will be read from the stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "optional #GCancellable object, %NULL to ignore."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "count"
--              , argType = TBasicType TUInt32
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "the number of bytes that will be read from the stream"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TInt32)
-- throws : True
-- Skip return : False

foreign import ccall "g_input_stream_read" g_input_stream_read :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Word8 ->                            -- buffer : TCArray False (-1) 2 (TBasicType TUInt8)
    Word32 ->                               -- count : TBasicType TUInt32
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO Int32

-- | Tries to read /@count@/ bytes from the stream into the buffer starting at
-- /@buffer@/. Will block during this read.
-- 
-- If count is zero returns zero and does nothing. A value of /@count@/
-- larger than @/G_MAXSSIZE/@ will cause a 'GI.Gio.Enums.IOErrorEnumInvalidArgument' error.
-- 
-- On success, the number of bytes read into the buffer is returned.
-- It is not an error if this is not the same as the requested size, as it
-- can happen e.g. near the end of a file. Zero is returned on end of file
-- (or if /@count@/ is zero),  but never otherwise.
-- 
-- The returned /@buffer@/ is not a nul-terminated string, it can contain nul bytes
-- at any position, and this function doesn\'t nul-terminate the /@buffer@/.
-- 
-- If /@cancellable@/ is not 'P.Nothing', then the operation can be cancelled by
-- triggering the cancellable object from another thread. If the operation
-- was cancelled, the error 'GI.Gio.Enums.IOErrorEnumCancelled' will be returned. If an
-- operation was partially finished when the operation was cancelled the
-- partial result will be returned, without an error.
-- 
-- On error -1 is returned and /@error@/ is set accordingly.
inputStreamRead ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@stream@/: a t'GI.Gio.Objects.InputStream.InputStream'.
    -> ByteString
    -- ^ /@buffer@/: 
    --     a buffer to read data into (which should be at least count bytes long).
    -> Maybe (b)
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> m ((Int32, ByteString))
    -- ^ __Returns:__ Number of bytes read, or -1 on error, or 0 on end of file. /(Can throw 'Data.GI.Base.GError.GError')/
inputStreamRead :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) =>
a -> ByteString -> Maybe b -> m (Int32, ByteString)
inputStreamRead a
stream ByteString
buffer Maybe b
cancellable = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    let count :: Word32
count = forall a b. (Integral a, Num b) => a -> b
fromIntegral forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buffer
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr Word8
buffer' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
buffer
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    forall a b. IO a -> IO b -> IO a
onException (do
        Int32
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr InputStream
-> Ptr Word8
-> Word32
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO Int32
g_input_stream_read Ptr InputStream
stream' Ptr Word8
buffer' Word32
count Ptr Cancellable
maybeCancellable
        ByteString
buffer'' <- (forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Word32
count) Ptr Word8
buffer'
        forall a. Ptr a -> IO ()
freeMem Ptr Word8
buffer'
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
        forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        forall (m :: * -> *) a. Monad m => a -> m a
return (Int32
result, ByteString
buffer'')
     ) (do
        forall a. Ptr a -> IO ()
freeMem Ptr Word8
buffer'
     )

#if defined(ENABLE_OVERLOADING)
data InputStreamReadMethodInfo
instance (signature ~ (ByteString -> Maybe (b) -> m ((Int32, ByteString))), MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod InputStreamReadMethodInfo a signature where
    overloadedMethod = inputStreamRead

instance O.OverloadedMethodInfo InputStreamReadMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamRead",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamRead"
        })


#endif

-- method InputStream::read_all
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GInputStream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buffer"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "\n    a buffer to read data into (which should be at least count bytes long)."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt32
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the number of bytes that will be read from the stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "bytes_read"
--           , argType = TBasicType TUInt32
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "location to store the number of bytes that was read from the stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "optional #GCancellable object, %NULL to ignore."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "count"
--              , argType = TBasicType TUInt32
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "the number of bytes that will be read from the stream"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_input_stream_read_all" g_input_stream_read_all :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Word8 ->                            -- buffer : TCArray False (-1) 2 (TBasicType TUInt8)
    Word32 ->                               -- count : TBasicType TUInt32
    Ptr Word32 ->                           -- bytes_read : TBasicType TUInt32
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Tries to read /@count@/ bytes from the stream into the buffer starting at
-- /@buffer@/. Will block during this read.
-- 
-- This function is similar to 'GI.Gio.Objects.InputStream.inputStreamRead', except it tries to
-- read as many bytes as requested, only stopping on an error or end of stream.
-- 
-- On a successful read of /@count@/ bytes, or if we reached the end of the
-- stream,  'P.True' is returned, and /@bytesRead@/ is set to the number of bytes
-- read into /@buffer@/.
-- 
-- If there is an error during the operation 'P.False' is returned and /@error@/
-- is set to indicate the error status.
-- 
-- As a special exception to the normal conventions for functions that
-- use t'GError', if this function returns 'P.False' (and sets /@error@/) then
-- /@bytesRead@/ will be set to the number of bytes that were successfully
-- read before the error was encountered.  This functionality is only
-- available from C.  If you need it from another language then you must
-- write your own loop around 'GI.Gio.Objects.InputStream.inputStreamRead'.
inputStreamReadAll ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@stream@/: a t'GI.Gio.Objects.InputStream.InputStream'.
    -> ByteString
    -- ^ /@buffer@/: 
    --     a buffer to read data into (which should be at least count bytes long).
    -> Maybe (b)
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> m ((ByteString, Word32))
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
inputStreamReadAll :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) =>
a -> ByteString -> Maybe b -> m (ByteString, Word32)
inputStreamReadAll a
stream ByteString
buffer Maybe b
cancellable = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    let count :: Word32
count = forall a b. (Integral a, Num b) => a -> b
fromIntegral forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buffer
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr Word8
buffer' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
buffer
    Ptr Word32
bytesRead <- forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word32)
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr InputStream
-> Ptr Word8
-> Word32
-> Ptr Word32
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
g_input_stream_read_all Ptr InputStream
stream' Ptr Word8
buffer' Word32
count Ptr Word32
bytesRead Ptr Cancellable
maybeCancellable
        ByteString
buffer'' <- (forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Word32
count) Ptr Word8
buffer'
        forall a. Ptr a -> IO ()
freeMem Ptr Word8
buffer'
        Word32
bytesRead' <- forall a. Storable a => Ptr a -> IO a
peek Ptr Word32
bytesRead
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
        forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        forall a. Ptr a -> IO ()
freeMem Ptr Word32
bytesRead
        forall (m :: * -> *) a. Monad m => a -> m a
return (ByteString
buffer'', Word32
bytesRead')
     ) (do
        forall a. Ptr a -> IO ()
freeMem Ptr Word8
buffer'
        forall a. Ptr a -> IO ()
freeMem Ptr Word32
bytesRead
     )

#if defined(ENABLE_OVERLOADING)
data InputStreamReadAllMethodInfo
instance (signature ~ (ByteString -> Maybe (b) -> m ((ByteString, Word32))), MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod InputStreamReadAllMethodInfo a signature where
    overloadedMethod = inputStreamReadAll

instance O.OverloadedMethodInfo InputStreamReadAllMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamReadAll",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamReadAll"
        })


#endif

-- method InputStream::read_all_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GInputStream" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buffer"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "\n    a buffer to read data into (which should be at least count bytes long)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt32
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the number of bytes that will be read from the stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "io_priority"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the [I/O priority][io-priority] of the request"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "optional #GCancellable object, %NULL to ignore"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "callback to call when the request is satisfied"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 6
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data to pass to callback function"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "count"
--              , argType = TBasicType TUInt32
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "the number of bytes that will be read from the stream"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_input_stream_read_all_async" g_input_stream_read_all_async :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Word8 ->                            -- buffer : TCArray False (-1) 2 (TBasicType TUInt8)
    Word32 ->                               -- count : TBasicType TUInt32
    Int32 ->                                -- io_priority : TBasicType TInt
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Request an asynchronous read of /@count@/ bytes from the stream into the
-- buffer starting at /@buffer@/.
-- 
-- This is the asynchronous equivalent of 'GI.Gio.Objects.InputStream.inputStreamReadAll'.
-- 
-- Call 'GI.Gio.Objects.InputStream.inputStreamReadAllFinish' to collect the result.
-- 
-- Any outstanding I\/O request with higher priority (lower numerical
-- value) will be executed before an outstanding request with lower
-- priority. Default priority is 'GI.GLib.Constants.PRIORITY_DEFAULT'.
-- 
-- /Since: 2.44/
inputStreamReadAllAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@stream@/: A t'GI.Gio.Objects.InputStream.InputStream'
    -> ByteString
    -- ^ /@buffer@/: 
    --     a buffer to read data into (which should be at least count bytes long)
    -> Int32
    -- ^ /@ioPriority@/: the [I\/O priority][io-priority] of the request
    -> Maybe (b)
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: callback to call when the request is satisfied
    -> m (ByteString)
inputStreamReadAllAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) =>
a
-> ByteString
-> Int32
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ByteString
inputStreamReadAllAsync a
stream ByteString
buffer Int32
ioPriority Maybe b
cancellable Maybe AsyncReadyCallback
callback = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    let count :: Word32
count = forall a b. (Integral a, Num b) => a -> b
fromIntegral forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buffer
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr Word8
buffer' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
buffer
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return (forall a b. Ptr a -> FunPtr b
castPtrToFunPtr forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = forall a. Ptr a
nullPtr
    Ptr InputStream
-> Ptr Word8
-> Word32
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_input_stream_read_all_async Ptr InputStream
stream' Ptr Word8
buffer' Word32
count Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback forall a. Ptr a
userData
    ByteString
buffer'' <- (forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Word32
count) Ptr Word8
buffer'
    forall a. Ptr a -> IO ()
freeMem Ptr Word8
buffer'
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
    forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    forall (m :: * -> *) a. Monad m => a -> m a
return ByteString
buffer''

#if defined(ENABLE_OVERLOADING)
data InputStreamReadAllAsyncMethodInfo
instance (signature ~ (ByteString -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m (ByteString)), MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod InputStreamReadAllAsyncMethodInfo a signature where
    overloadedMethod = inputStreamReadAllAsync

instance O.OverloadedMethodInfo InputStreamReadAllAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamReadAllAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamReadAllAsync"
        })


#endif

-- method InputStream::read_all_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GInputStream" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GAsyncResult" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "bytes_read"
--           , argType = TBasicType TUInt32
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "location to store the number of bytes that was read from the stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_input_stream_read_all_finish" g_input_stream_read_all_finish :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr Word32 ->                           -- bytes_read : TBasicType TUInt32
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Finishes an asynchronous stream read operation started with
-- 'GI.Gio.Objects.InputStream.inputStreamReadAllAsync'.
-- 
-- As a special exception to the normal conventions for functions that
-- use t'GError', if this function returns 'P.False' (and sets /@error@/) then
-- /@bytesRead@/ will be set to the number of bytes that were successfully
-- read before the error was encountered.  This functionality is only
-- available from C.  If you need it from another language then you must
-- write your own loop around 'GI.Gio.Objects.InputStream.inputStreamReadAsync'.
-- 
-- /Since: 2.44/
inputStreamReadAllFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@stream@/: a t'GI.Gio.Objects.InputStream.InputStream'
    -> b
    -- ^ /@result@/: a t'GI.Gio.Interfaces.AsyncResult.AsyncResult'
    -> m (Word32)
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
inputStreamReadAllFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsAsyncResult b) =>
a -> b -> m Word32
inputStreamReadAllFinish a
stream b
result_ = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr AsyncResult
result_' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    Ptr Word32
bytesRead <- forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word32)
    forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr InputStream
-> Ptr AsyncResult -> Ptr Word32 -> Ptr (Ptr GError) -> IO CInt
g_input_stream_read_all_finish Ptr InputStream
stream' Ptr AsyncResult
result_' Ptr Word32
bytesRead
        Word32
bytesRead' <- forall a. Storable a => Ptr a -> IO a
peek Ptr Word32
bytesRead
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        forall a. Ptr a -> IO ()
freeMem Ptr Word32
bytesRead
        forall (m :: * -> *) a. Monad m => a -> m a
return Word32
bytesRead'
     ) (do
        forall a. Ptr a -> IO ()
freeMem Ptr Word32
bytesRead
     )

#if defined(ENABLE_OVERLOADING)
data InputStreamReadAllFinishMethodInfo
instance (signature ~ (b -> m (Word32)), MonadIO m, IsInputStream a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod InputStreamReadAllFinishMethodInfo a signature where
    overloadedMethod = inputStreamReadAllFinish

instance O.OverloadedMethodInfo InputStreamReadAllFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamReadAllFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamReadAllFinish"
        })


#endif

-- method InputStream::read_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GInputStream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buffer"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "\n    a buffer to read data into (which should be at least count bytes long)."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt32
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the number of bytes that will be read from the stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "io_priority"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the [I/O priority][io-priority]\nof the request."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "optional #GCancellable object, %NULL to ignore."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "callback to call when the request is satisfied"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 6
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data to pass to callback function"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "count"
--              , argType = TBasicType TUInt32
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "the number of bytes that will be read from the stream"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_input_stream_read_async" g_input_stream_read_async :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Word8 ->                            -- buffer : TCArray False (-1) 2 (TBasicType TUInt8)
    Word32 ->                               -- count : TBasicType TUInt32
    Int32 ->                                -- io_priority : TBasicType TInt
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Request an asynchronous read of /@count@/ bytes from the stream into the buffer
-- starting at /@buffer@/. When the operation is finished /@callback@/ will be called.
-- You can then call 'GI.Gio.Objects.InputStream.inputStreamReadFinish' to get the result of the
-- operation.
-- 
-- During an async request no other sync and async calls are allowed on /@stream@/, and will
-- result in 'GI.Gio.Enums.IOErrorEnumPending' errors.
-- 
-- A value of /@count@/ larger than @/G_MAXSSIZE/@ will cause a 'GI.Gio.Enums.IOErrorEnumInvalidArgument' error.
-- 
-- On success, the number of bytes read into the buffer will be passed to the
-- callback. It is not an error if this is not the same as the requested size, as it
-- can happen e.g. near the end of a file, but generally we try to read
-- as many bytes as requested. Zero is returned on end of file
-- (or if /@count@/ is zero),  but never otherwise.
-- 
-- Any outstanding i\/o request with higher priority (lower numerical value) will
-- be executed before an outstanding request with lower priority. Default
-- priority is 'GI.GLib.Constants.PRIORITY_DEFAULT'.
-- 
-- The asynchronous methods have a default fallback that uses threads to implement
-- asynchronicity, so they are optional for inheriting classes. However, if you
-- override one you must override all.
inputStreamReadAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@stream@/: A t'GI.Gio.Objects.InputStream.InputStream'.
    -> Maybe (ByteString)
    -- ^ /@buffer@/: 
    --     a buffer to read data into (which should be at least count bytes long).
    -> Int32
    -- ^ /@ioPriority@/: the [I\/O priority][io-priority]
    -- of the request.
    -> Maybe (b)
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: callback to call when the request is satisfied
    -> m ((Maybe ByteString))
inputStreamReadAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) =>
a
-> Maybe ByteString
-> Int32
-> Maybe b
-> Maybe AsyncReadyCallback
-> m (Maybe ByteString)
inputStreamReadAsync a
stream Maybe ByteString
buffer Int32
ioPriority Maybe b
cancellable Maybe AsyncReadyCallback
callback = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    let count :: Word32
count = case Maybe ByteString
buffer of
            Maybe ByteString
Nothing -> Word32
0
            Just ByteString
jBuffer -> forall a b. (Integral a, Num b) => a -> b
fromIntegral forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
jBuffer
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr Word8
maybeBuffer <- case Maybe ByteString
buffer of
        Maybe ByteString
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just ByteString
jBuffer -> do
            Ptr Word8
jBuffer' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
jBuffer
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Word8
jBuffer'
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return (forall a b. Ptr a -> FunPtr b
castPtrToFunPtr forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = forall a. Ptr a
nullPtr
    Ptr InputStream
-> Ptr Word8
-> Word32
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_input_stream_read_async Ptr InputStream
stream' Ptr Word8
maybeBuffer Word32
count Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback forall a. Ptr a
userData
    Maybe ByteString
maybeMaybeBuffer <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Word8
maybeBuffer forall a b. (a -> b) -> a -> b
$ \Ptr Word8
maybeBuffer' -> do
        ByteString
maybeBuffer'' <- (forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Word32
count) Ptr Word8
maybeBuffer'
        forall a. Ptr a -> IO ()
freeMem Ptr Word8
maybeBuffer'
        forall (m :: * -> *) a. Monad m => a -> m a
return ByteString
maybeBuffer''
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
    forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ByteString
maybeMaybeBuffer

#if defined(ENABLE_OVERLOADING)
data InputStreamReadAsyncMethodInfo
instance (signature ~ (Maybe (ByteString) -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ((Maybe ByteString))), MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod InputStreamReadAsyncMethodInfo a signature where
    overloadedMethod = inputStreamReadAsync

instance O.OverloadedMethodInfo InputStreamReadAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamReadAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamReadAsync"
        })


#endif

-- method InputStream::read_bytes
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GInputStream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt32
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "maximum number of bytes that will be read from the stream. Common\nvalues include 4096 and 8192."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "optional #GCancellable object, %NULL to ignore."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "GLib" , name = "Bytes" })
-- throws : True
-- Skip return : False

foreign import ccall "g_input_stream_read_bytes" g_input_stream_read_bytes :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Word32 ->                               -- count : TBasicType TUInt32
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr GLib.Bytes.Bytes)

-- | Like 'GI.Gio.Objects.InputStream.inputStreamRead', this tries to read /@count@/ bytes from
-- the stream in a blocking fashion. However, rather than reading into
-- a user-supplied buffer, this will create a new t'GI.GLib.Structs.Bytes.Bytes' containing
-- the data that was read. This may be easier to use from language
-- bindings.
-- 
-- If count is zero, returns a zero-length t'GI.GLib.Structs.Bytes.Bytes' and does nothing. A
-- value of /@count@/ larger than @/G_MAXSSIZE/@ will cause a
-- 'GI.Gio.Enums.IOErrorEnumInvalidArgument' error.
-- 
-- On success, a new t'GI.GLib.Structs.Bytes.Bytes' is returned. It is not an error if the
-- size of this object is not the same as the requested size, as it
-- can happen e.g. near the end of a file. A zero-length t'GI.GLib.Structs.Bytes.Bytes' is
-- returned on end of file (or if /@count@/ is zero), but never
-- otherwise.
-- 
-- If /@cancellable@/ is not 'P.Nothing', then the operation can be cancelled by
-- triggering the cancellable object from another thread. If the operation
-- was cancelled, the error 'GI.Gio.Enums.IOErrorEnumCancelled' will be returned. If an
-- operation was partially finished when the operation was cancelled the
-- partial result will be returned, without an error.
-- 
-- On error 'P.Nothing' is returned and /@error@/ is set accordingly.
-- 
-- /Since: 2.34/
inputStreamReadBytes ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@stream@/: a t'GI.Gio.Objects.InputStream.InputStream'.
    -> Word32
    -- ^ /@count@/: maximum number of bytes that will be read from the stream. Common
    -- values include 4096 and 8192.
    -> Maybe (b)
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> m GLib.Bytes.Bytes
    -- ^ __Returns:__ a new t'GI.GLib.Structs.Bytes.Bytes', or 'P.Nothing' on error /(Can throw 'Data.GI.Base.GError.GError')/
inputStreamReadBytes :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) =>
a -> Word32 -> Maybe b -> m Bytes
inputStreamReadBytes a
stream Word32
count Maybe b
cancellable = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    forall a b. IO a -> IO b -> IO a
onException (do
        Ptr Bytes
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr InputStream
-> Word32 -> Ptr Cancellable -> Ptr (Ptr GError) -> IO (Ptr Bytes)
g_input_stream_read_bytes Ptr InputStream
stream' Word32
count Ptr Cancellable
maybeCancellable
        forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"inputStreamReadBytes" Ptr Bytes
result
        Bytes
result' <- (forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Bytes -> Bytes
GLib.Bytes.Bytes) Ptr Bytes
result
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
        forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        forall (m :: * -> *) a. Monad m => a -> m a
return Bytes
result'
     ) (do
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data InputStreamReadBytesMethodInfo
instance (signature ~ (Word32 -> Maybe (b) -> m GLib.Bytes.Bytes), MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod InputStreamReadBytesMethodInfo a signature where
    overloadedMethod = inputStreamReadBytes

instance O.OverloadedMethodInfo InputStreamReadBytesMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamReadBytes",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamReadBytes"
        })


#endif

-- method InputStream::read_bytes_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GInputStream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt32
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the number of bytes that will be read from the stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "io_priority"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the [I/O priority][io-priority] of the request"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "optional #GCancellable object, %NULL to ignore."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "callback to call when the request is satisfied"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 5
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data to pass to callback function"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_input_stream_read_bytes_async" g_input_stream_read_bytes_async :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Word32 ->                               -- count : TBasicType TUInt32
    Int32 ->                                -- io_priority : TBasicType TInt
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Request an asynchronous read of /@count@/ bytes from the stream into a
-- new t'GI.GLib.Structs.Bytes.Bytes'. When the operation is finished /@callback@/ will be
-- called. You can then call 'GI.Gio.Objects.InputStream.inputStreamReadBytesFinish' to get the
-- result of the operation.
-- 
-- During an async request no other sync and async calls are allowed
-- on /@stream@/, and will result in 'GI.Gio.Enums.IOErrorEnumPending' errors.
-- 
-- A value of /@count@/ larger than @/G_MAXSSIZE/@ will cause a
-- 'GI.Gio.Enums.IOErrorEnumInvalidArgument' error.
-- 
-- On success, the new t'GI.GLib.Structs.Bytes.Bytes' will be passed to the callback. It is
-- not an error if this is smaller than the requested size, as it can
-- happen e.g. near the end of a file, but generally we try to read as
-- many bytes as requested. Zero is returned on end of file (or if
-- /@count@/ is zero), but never otherwise.
-- 
-- Any outstanding I\/O request with higher priority (lower numerical
-- value) will be executed before an outstanding request with lower
-- priority. Default priority is 'GI.GLib.Constants.PRIORITY_DEFAULT'.
-- 
-- /Since: 2.34/
inputStreamReadBytesAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@stream@/: A t'GI.Gio.Objects.InputStream.InputStream'.
    -> Word32
    -- ^ /@count@/: the number of bytes that will be read from the stream
    -> Int32
    -- ^ /@ioPriority@/: the [I\/O priority][io-priority] of the request
    -> Maybe (b)
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: callback to call when the request is satisfied
    -> m ()
inputStreamReadBytesAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) =>
a -> Word32 -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
inputStreamReadBytesAsync a
stream Word32
count Int32
ioPriority Maybe b
cancellable Maybe AsyncReadyCallback
callback = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return (forall a b. Ptr a -> FunPtr b
castPtrToFunPtr forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = forall a. Ptr a
nullPtr
    Ptr InputStream
-> Word32
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_input_stream_read_bytes_async Ptr InputStream
stream' Word32
count Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback forall a. Ptr a
userData
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
    forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data InputStreamReadBytesAsyncMethodInfo
instance (signature ~ (Word32 -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod InputStreamReadBytesAsyncMethodInfo a signature where
    overloadedMethod = inputStreamReadBytesAsync

instance O.OverloadedMethodInfo InputStreamReadBytesAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamReadBytesAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamReadBytesAsync"
        })


#endif

-- method InputStream::read_bytes_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GInputStream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GAsyncResult." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "GLib" , name = "Bytes" })
-- throws : True
-- Skip return : False

foreign import ccall "g_input_stream_read_bytes_finish" g_input_stream_read_bytes_finish :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr GLib.Bytes.Bytes)

-- | Finishes an asynchronous stream read-into-t'GI.GLib.Structs.Bytes.Bytes' operation.
-- 
-- /Since: 2.34/
inputStreamReadBytesFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@stream@/: a t'GI.Gio.Objects.InputStream.InputStream'.
    -> b
    -- ^ /@result@/: a t'GI.Gio.Interfaces.AsyncResult.AsyncResult'.
    -> m GLib.Bytes.Bytes
    -- ^ __Returns:__ the newly-allocated t'GI.GLib.Structs.Bytes.Bytes', or 'P.Nothing' on error /(Can throw 'Data.GI.Base.GError.GError')/
inputStreamReadBytesFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsAsyncResult b) =>
a -> b -> m Bytes
inputStreamReadBytesFinish a
stream b
result_ = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr AsyncResult
result_' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    forall a b. IO a -> IO b -> IO a
onException (do
        Ptr Bytes
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr InputStream
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr Bytes)
g_input_stream_read_bytes_finish Ptr InputStream
stream' Ptr AsyncResult
result_'
        forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"inputStreamReadBytesFinish" Ptr Bytes
result
        Bytes
result' <- (forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Bytes -> Bytes
GLib.Bytes.Bytes) Ptr Bytes
result
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        forall (m :: * -> *) a. Monad m => a -> m a
return Bytes
result'
     ) (do
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data InputStreamReadBytesFinishMethodInfo
instance (signature ~ (b -> m GLib.Bytes.Bytes), MonadIO m, IsInputStream a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod InputStreamReadBytesFinishMethodInfo a signature where
    overloadedMethod = inputStreamReadBytesFinish

instance O.OverloadedMethodInfo InputStreamReadBytesFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamReadBytesFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamReadBytesFinish"
        })


#endif

-- method InputStream::read_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GInputStream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GAsyncResult." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt32)
-- throws : True
-- Skip return : False

foreign import ccall "g_input_stream_read_finish" g_input_stream_read_finish :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO Int32

-- | Finishes an asynchronous stream read operation.
inputStreamReadFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@stream@/: a t'GI.Gio.Objects.InputStream.InputStream'.
    -> b
    -- ^ /@result@/: a t'GI.Gio.Interfaces.AsyncResult.AsyncResult'.
    -> m Int32
    -- ^ __Returns:__ number of bytes read in, or -1 on error, or 0 on end of file. /(Can throw 'Data.GI.Base.GError.GError')/
inputStreamReadFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsAsyncResult b) =>
a -> b -> m Int32
inputStreamReadFinish a
stream b
result_ = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr AsyncResult
result_' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    forall a b. IO a -> IO b -> IO a
onException (do
        Int32
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr InputStream -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO Int32
g_input_stream_read_finish Ptr InputStream
stream' Ptr AsyncResult
result_'
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
     ) (do
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data InputStreamReadFinishMethodInfo
instance (signature ~ (b -> m Int32), MonadIO m, IsInputStream a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod InputStreamReadFinishMethodInfo a signature where
    overloadedMethod = inputStreamReadFinish

instance O.OverloadedMethodInfo InputStreamReadFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamReadFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamReadFinish"
        })


#endif

-- method InputStream::set_pending
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "input stream" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_input_stream_set_pending" g_input_stream_set_pending :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Sets /@stream@/ to have actions pending. If the pending flag is
-- already set or /@stream@/ is closed, it will return 'P.False' and set
-- /@error@/.
inputStreamSetPending ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a) =>
    a
    -- ^ /@stream@/: input stream
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
inputStreamSetPending :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsInputStream a) =>
a -> m ()
inputStreamSetPending a
stream = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr InputStream -> Ptr (Ptr GError) -> IO CInt
g_input_stream_set_pending Ptr InputStream
stream'
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data InputStreamSetPendingMethodInfo
instance (signature ~ (m ()), MonadIO m, IsInputStream a) => O.OverloadedMethod InputStreamSetPendingMethodInfo a signature where
    overloadedMethod = inputStreamSetPending

instance O.OverloadedMethodInfo InputStreamSetPendingMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamSetPending",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamSetPending"
        })


#endif

-- method InputStream::skip
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GInputStream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt32
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the number of bytes that will be skipped from the stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "optional #GCancellable object, %NULL to ignore."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt32)
-- throws : True
-- Skip return : False

foreign import ccall "g_input_stream_skip" g_input_stream_skip :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Word32 ->                               -- count : TBasicType TUInt32
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO Int32

-- | Tries to skip /@count@/ bytes from the stream. Will block during the operation.
-- 
-- This is identical to 'GI.Gio.Objects.InputStream.inputStreamRead', from a behaviour standpoint,
-- but the bytes that are skipped are not returned to the user. Some
-- streams have an implementation that is more efficient than reading the data.
-- 
-- This function is optional for inherited classes, as the default implementation
-- emulates it using read.
-- 
-- If /@cancellable@/ is not 'P.Nothing', then the operation can be cancelled by
-- triggering the cancellable object from another thread. If the operation
-- was cancelled, the error 'GI.Gio.Enums.IOErrorEnumCancelled' will be returned. If an
-- operation was partially finished when the operation was cancelled the
-- partial result will be returned, without an error.
inputStreamSkip ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@stream@/: a t'GI.Gio.Objects.InputStream.InputStream'.
    -> Word32
    -- ^ /@count@/: the number of bytes that will be skipped from the stream
    -> Maybe (b)
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> m Int32
    -- ^ __Returns:__ Number of bytes skipped, or -1 on error /(Can throw 'Data.GI.Base.GError.GError')/
inputStreamSkip :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) =>
a -> Word32 -> Maybe b -> m Int32
inputStreamSkip a
stream Word32
count Maybe b
cancellable = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    forall a b. IO a -> IO b -> IO a
onException (do
        Int32
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr InputStream
-> Word32 -> Ptr Cancellable -> Ptr (Ptr GError) -> IO Int32
g_input_stream_skip Ptr InputStream
stream' Word32
count Ptr Cancellable
maybeCancellable
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
        forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
     ) (do
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data InputStreamSkipMethodInfo
instance (signature ~ (Word32 -> Maybe (b) -> m Int32), MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod InputStreamSkipMethodInfo a signature where
    overloadedMethod = inputStreamSkip

instance O.OverloadedMethodInfo InputStreamSkipMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamSkip",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamSkip"
        })


#endif

-- method InputStream::skip_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GInputStream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt32
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the number of bytes that will be skipped from the stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "io_priority"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the [I/O priority][io-priority] of the request"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "optional #GCancellable object, %NULL to ignore."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "callback to call when the request is satisfied"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 5
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data to pass to callback function"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_input_stream_skip_async" g_input_stream_skip_async :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Word32 ->                               -- count : TBasicType TUInt32
    Int32 ->                                -- io_priority : TBasicType TInt
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Request an asynchronous skip of /@count@/ bytes from the stream.
-- When the operation is finished /@callback@/ will be called.
-- You can then call 'GI.Gio.Objects.InputStream.inputStreamSkipFinish' to get the result
-- of the operation.
-- 
-- During an async request no other sync and async calls are allowed,
-- and will result in 'GI.Gio.Enums.IOErrorEnumPending' errors.
-- 
-- A value of /@count@/ larger than @/G_MAXSSIZE/@ will cause a 'GI.Gio.Enums.IOErrorEnumInvalidArgument' error.
-- 
-- On success, the number of bytes skipped will be passed to the callback.
-- It is not an error if this is not the same as the requested size, as it
-- can happen e.g. near the end of a file, but generally we try to skip
-- as many bytes as requested. Zero is returned on end of file
-- (or if /@count@/ is zero), but never otherwise.
-- 
-- Any outstanding i\/o request with higher priority (lower numerical value)
-- will be executed before an outstanding request with lower priority.
-- Default priority is 'GI.GLib.Constants.PRIORITY_DEFAULT'.
-- 
-- The asynchronous methods have a default fallback that uses threads to
-- implement asynchronicity, so they are optional for inheriting classes.
-- However, if you override one, you must override all.
inputStreamSkipAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@stream@/: A t'GI.Gio.Objects.InputStream.InputStream'.
    -> Word32
    -- ^ /@count@/: the number of bytes that will be skipped from the stream
    -> Int32
    -- ^ /@ioPriority@/: the [I\/O priority][io-priority] of the request
    -> Maybe (b)
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: callback to call when the request is satisfied
    -> m ()
inputStreamSkipAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) =>
a -> Word32 -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
inputStreamSkipAsync a
stream Word32
count Int32
ioPriority Maybe b
cancellable Maybe AsyncReadyCallback
callback = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return (forall a b. Ptr a -> FunPtr b
castPtrToFunPtr forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = forall a. Ptr a
nullPtr
    Ptr InputStream
-> Word32
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_input_stream_skip_async Ptr InputStream
stream' Word32
count Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback forall a. Ptr a
userData
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
    forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data InputStreamSkipAsyncMethodInfo
instance (signature ~ (Word32 -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsInputStream a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod InputStreamSkipAsyncMethodInfo a signature where
    overloadedMethod = inputStreamSkipAsync

instance O.OverloadedMethodInfo InputStreamSkipAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamSkipAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamSkipAsync"
        })


#endif

-- method InputStream::skip_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GInputStream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GAsyncResult." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt32)
-- throws : True
-- Skip return : False

foreign import ccall "g_input_stream_skip_finish" g_input_stream_skip_finish :: 
    Ptr InputStream ->                      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO Int32

-- | Finishes a stream skip operation.
inputStreamSkipFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsInputStream a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@stream@/: a t'GI.Gio.Objects.InputStream.InputStream'.
    -> b
    -- ^ /@result@/: a t'GI.Gio.Interfaces.AsyncResult.AsyncResult'.
    -> m Int32
    -- ^ __Returns:__ the size of the bytes skipped, or @-1@ on error. /(Can throw 'Data.GI.Base.GError.GError')/
inputStreamSkipFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsAsyncResult b) =>
a -> b -> m Int32
inputStreamSkipFinish a
stream b
result_ = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
stream' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr AsyncResult
result_' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    forall a b. IO a -> IO b -> IO a
onException (do
        Int32
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr InputStream -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO Int32
g_input_stream_skip_finish Ptr InputStream
stream' Ptr AsyncResult
result_'
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
     ) (do
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data InputStreamSkipFinishMethodInfo
instance (signature ~ (b -> m Int32), MonadIO m, IsInputStream a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod InputStreamSkipFinishMethodInfo a signature where
    overloadedMethod = inputStreamSkipFinish

instance O.OverloadedMethodInfo InputStreamSkipFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.InputStream.inputStreamSkipFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-InputStream.html#v:inputStreamSkipFinish"
        })


#endif