Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
GI.Gio.Objects.OutputStream
Contents
- Exported types
- Methods
- clearPending
- close
- closeAsync
- closeFinish
- flush
- flushAsync
- flushFinish
- hasPending
- isClosed
- isClosing
- setPending
- splice
- spliceAsync
- spliceFinish
- write
- writeAll
- writeAllAsync
- writeAllFinish
- writeAsync
- writeBytes
- writeBytesAsync
- writeBytesFinish
- writeFinish
- writev
- writevAll
- writevAllAsync
- writevAllFinish
- writevAsync
- writevFinish
Description
GOutputStream
is a base class for implementing streaming output.
It has functions to write to a stream (outputStreamWrite
),
to close a stream (outputStreamClose
) and to flush pending
writes (outputStreamFlush
).
To copy the content of an input stream to an output stream without
manually handling the reads and writes, use outputStreamSplice
.
See the documentation for IOStream
for details of thread safety
of streaming APIs.
All of these functions have async variants too.
All classes derived from GOutputStream
*should* implement synchronous
writing, splicing, flushing and closing streams, but *may* implement
asynchronous versions.
Synopsis
- newtype OutputStream = OutputStream (ManagedPtr OutputStream)
- class (GObject o, IsDescendantOf OutputStream o) => IsOutputStream o
- toOutputStream :: (MonadIO m, IsOutputStream o) => o -> m OutputStream
- type family ResolveOutputStreamMethod (t :: Symbol) o where ...
- data OutputStreamClearPendingMethodInfo
- outputStreamClearPending :: (HasCallStack, MonadIO m, IsOutputStream a) => a -> m ()
- data OutputStreamCloseMethodInfo
- outputStreamClose :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> Maybe b -> m ()
- data OutputStreamCloseAsyncMethodInfo
- outputStreamCloseAsync :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data OutputStreamCloseFinishMethodInfo
- outputStreamCloseFinish :: (HasCallStack, MonadIO m, IsOutputStream a, IsAsyncResult b) => a -> b -> m ()
- data OutputStreamFlushMethodInfo
- outputStreamFlush :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> Maybe b -> m ()
- data OutputStreamFlushAsyncMethodInfo
- outputStreamFlushAsync :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data OutputStreamFlushFinishMethodInfo
- outputStreamFlushFinish :: (HasCallStack, MonadIO m, IsOutputStream a, IsAsyncResult b) => a -> b -> m ()
- data OutputStreamHasPendingMethodInfo
- outputStreamHasPending :: (HasCallStack, MonadIO m, IsOutputStream a) => a -> m Bool
- data OutputStreamIsClosedMethodInfo
- outputStreamIsClosed :: (HasCallStack, MonadIO m, IsOutputStream a) => a -> m Bool
- data OutputStreamIsClosingMethodInfo
- outputStreamIsClosing :: (HasCallStack, MonadIO m, IsOutputStream a) => a -> m Bool
- data OutputStreamSetPendingMethodInfo
- outputStreamSetPending :: (HasCallStack, MonadIO m, IsOutputStream a) => a -> m ()
- data OutputStreamSpliceMethodInfo
- outputStreamSplice :: (HasCallStack, MonadIO m, IsOutputStream a, IsInputStream b, IsCancellable c) => a -> b -> [OutputStreamSpliceFlags] -> Maybe c -> m Int64
- data OutputStreamSpliceAsyncMethodInfo
- outputStreamSpliceAsync :: (HasCallStack, MonadIO m, IsOutputStream a, IsInputStream b, IsCancellable c) => a -> b -> [OutputStreamSpliceFlags] -> Int32 -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- data OutputStreamSpliceFinishMethodInfo
- outputStreamSpliceFinish :: (HasCallStack, MonadIO m, IsOutputStream a, IsAsyncResult b) => a -> b -> m Int64
- data OutputStreamWriteMethodInfo
- outputStreamWrite :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> ByteString -> Maybe b -> m Int64
- data OutputStreamWriteAllMethodInfo
- outputStreamWriteAll :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> ByteString -> Maybe b -> m CSize
- data OutputStreamWriteAllAsyncMethodInfo
- outputStreamWriteAllAsync :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> ByteString -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data OutputStreamWriteAllFinishMethodInfo
- outputStreamWriteAllFinish :: (HasCallStack, MonadIO m, IsOutputStream a, IsAsyncResult b) => a -> b -> m CSize
- data OutputStreamWriteAsyncMethodInfo
- outputStreamWriteAsync :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> Maybe ByteString -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data OutputStreamWriteBytesMethodInfo
- outputStreamWriteBytes :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> Bytes -> Maybe b -> m Int64
- data OutputStreamWriteBytesAsyncMethodInfo
- outputStreamWriteBytesAsync :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> Bytes -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data OutputStreamWriteBytesFinishMethodInfo
- outputStreamWriteBytesFinish :: (HasCallStack, MonadIO m, IsOutputStream a, IsAsyncResult b) => a -> b -> m Int64
- data OutputStreamWriteFinishMethodInfo
- outputStreamWriteFinish :: (HasCallStack, MonadIO m, IsOutputStream a, IsAsyncResult b) => a -> b -> m Int64
- data OutputStreamWritevMethodInfo
- outputStreamWritev :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> [OutputVector] -> Maybe b -> m CSize
- data OutputStreamWritevAllMethodInfo
- outputStreamWritevAll :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> [OutputVector] -> Maybe b -> m CSize
- data OutputStreamWritevAllAsyncMethodInfo
- outputStreamWritevAllAsync :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> [OutputVector] -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data OutputStreamWritevAllFinishMethodInfo
- outputStreamWritevAllFinish :: (HasCallStack, MonadIO m, IsOutputStream a, IsAsyncResult b) => a -> b -> m CSize
- data OutputStreamWritevAsyncMethodInfo
- outputStreamWritevAsync :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> [OutputVector] -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data OutputStreamWritevFinishMethodInfo
- outputStreamWritevFinish :: (HasCallStack, MonadIO m, IsOutputStream a, IsAsyncResult b) => a -> b -> m CSize
Exported types
newtype OutputStream Source #
Memory-managed wrapper type.
Constructors
OutputStream (ManagedPtr OutputStream) |
Instances
class (GObject o, IsDescendantOf OutputStream o) => IsOutputStream o Source #
Type class for types which can be safely cast to OutputStream
, for instance with toOutputStream
.
Instances
(GObject o, IsDescendantOf OutputStream o) => IsOutputStream o Source # | |
Defined in GI.Gio.Objects.OutputStream |
toOutputStream :: (MonadIO m, IsOutputStream o) => o -> m OutputStream Source #
Cast to OutputStream
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, clearPending, close, closeAsync, closeFinish, flush, flushAsync, flushFinish, forceFloating, freezeNotify, getv, hasPending, isClosed, isClosing, isFloating, notify, notifyByPspec, ref, refSink, runDispose, splice, spliceAsync, spliceFinish, stealData, stealQdata, thawNotify, unref, watchClosure, write, writeAll, writeAllAsync, writeAllFinish, writeAsync, writeBytes, writeBytesAsync, writeBytesFinish, writeFinish, writev, writevAll, writevAllAsync, writevAllFinish, writevAsync, writevFinish.
Getters
getData, getProperty, getQdata.
Setters
type family ResolveOutputStreamMethod (t :: Symbol) o where ... Source #
Equations
clearPending
data OutputStreamClearPendingMethodInfo Source #
Instances
(signature ~ m (), MonadIO m, IsOutputStream a) => OverloadedMethod OutputStreamClearPendingMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamClearPendingMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamClearPending Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a) | |
=> a |
|
-> m () |
Clears the pending flag on stream
.
close
data OutputStreamCloseMethodInfo Source #
Instances
(signature ~ (Maybe b -> m ()), MonadIO m, IsOutputStream a, IsCancellable b) => OverloadedMethod OutputStreamCloseMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamCloseMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m () | (Can throw |
Closes the stream, releasing resources related to it.
Once the stream is closed, all other operations will return IOErrorEnumClosed
.
Closing a stream multiple times will not return an error.
Closing a stream will automatically flush any outstanding buffers in the stream.
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 IOErrorEnumClosed
for all operations. Still, it
is important to check and report the error to the user, otherwise
there might be a loss of data as all data might not be written.
If cancellable
is not Nothing
, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error IOErrorEnumCancelled
will be returned.
Cancelling a close will still leave the stream closed, but there some streams
can use a faster close that doesn't block to e.g. check errors. On
cancellation (as with any error) there is no guarantee that all written
data will reach the target.
closeAsync
data OutputStreamCloseAsyncMethodInfo Source #
Instances
(signature ~ (Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsOutputStream a, IsCancellable b) => OverloadedMethod OutputStreamCloseAsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamCloseAsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamCloseAsync Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Requests an asynchronous close of the stream, releasing resources
related to it. When the operation is finished callback
will be
called. You can then call outputStreamCloseFinish
to get
the result of the operation.
For behaviour details see outputStreamClose
.
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.
closeFinish
data OutputStreamCloseFinishMethodInfo Source #
Instances
(signature ~ (b -> m ()), MonadIO m, IsOutputStream a, IsAsyncResult b) => OverloadedMethod OutputStreamCloseFinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamCloseFinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamCloseFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Closes an output stream.
flush
data OutputStreamFlushMethodInfo Source #
Instances
(signature ~ (Maybe b -> m ()), MonadIO m, IsOutputStream a, IsCancellable b) => OverloadedMethod OutputStreamFlushMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamFlushMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m () | (Can throw |
Forces a write of all user-space buffered data for the given
stream
. Will block during the operation. Closing the stream will
implicitly cause a flush.
This function is optional for inherited classes.
If cancellable
is not Nothing
, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error IOErrorEnumCancelled
will be returned.
flushAsync
data OutputStreamFlushAsyncMethodInfo Source #
Instances
(signature ~ (Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsOutputStream a, IsCancellable b) => OverloadedMethod OutputStreamFlushAsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamFlushAsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamFlushAsync Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Forces an asynchronous write of all user-space buffered data for
the given stream
.
For behaviour details see outputStreamFlush
.
When the operation is finished callback
will be
called. You can then call outputStreamFlushFinish
to get the
result of the operation.
flushFinish
data OutputStreamFlushFinishMethodInfo Source #
Instances
(signature ~ (b -> m ()), MonadIO m, IsOutputStream a, IsAsyncResult b) => OverloadedMethod OutputStreamFlushFinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamFlushFinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamFlushFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Finishes flushing an output stream.
hasPending
data OutputStreamHasPendingMethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsOutputStream a) => OverloadedMethod OutputStreamHasPendingMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamHasPendingMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamHasPending Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a) | |
=> a |
|
-> m Bool | Returns: |
Checks if an output stream has pending actions.
isClosed
data OutputStreamIsClosedMethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsOutputStream a) => OverloadedMethod OutputStreamIsClosedMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamIsClosedMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a) | |
=> a |
|
-> m Bool |
Checks if an output stream has already been closed.
isClosing
data OutputStreamIsClosingMethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsOutputStream a) => OverloadedMethod OutputStreamIsClosingMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamIsClosingMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamIsClosing Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a) | |
=> a |
|
-> m Bool |
Checks if an output stream is being closed. This can be used inside e.g. a flush implementation to see if the flush (or other i/o operation) is called from within the closing operation.
Since: 2.24
setPending
data OutputStreamSetPendingMethodInfo Source #
Instances
(signature ~ m (), MonadIO m, IsOutputStream a) => OverloadedMethod OutputStreamSetPendingMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamSetPendingMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamSetPending Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a) | |
=> a |
|
-> m () | (Can throw |
Sets stream
to have actions pending. If the pending flag is
already set or stream
is closed, it will return False
and set
error
.
splice
data OutputStreamSpliceMethodInfo Source #
Instances
(signature ~ (b -> [OutputStreamSpliceFlags] -> Maybe c -> m Int64), MonadIO m, IsOutputStream a, IsInputStream b, IsCancellable c) => OverloadedMethod OutputStreamSpliceMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamSpliceMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsInputStream b, IsCancellable c) | |
=> a |
|
-> b |
|
-> [OutputStreamSpliceFlags] |
|
-> Maybe c |
|
-> m Int64 | Returns: a |
Splices an input stream into an output stream.
spliceAsync
data OutputStreamSpliceAsyncMethodInfo Source #
Instances
(signature ~ (b -> [OutputStreamSpliceFlags] -> Int32 -> Maybe c -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsOutputStream a, IsInputStream b, IsCancellable c) => OverloadedMethod OutputStreamSpliceAsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamSpliceAsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamSpliceAsync Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsInputStream b, IsCancellable c) | |
=> a |
|
-> b |
|
-> [OutputStreamSpliceFlags] |
|
-> Int32 |
|
-> Maybe c |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Splices a stream asynchronously.
When the operation is finished callback
will be called.
You can then call outputStreamSpliceFinish
to get the
result of the operation.
For the synchronous, blocking version of this function, see
outputStreamSplice
.
spliceFinish
data OutputStreamSpliceFinishMethodInfo Source #
Instances
(signature ~ (b -> m Int64), MonadIO m, IsOutputStream a, IsAsyncResult b) => OverloadedMethod OutputStreamSpliceFinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamSpliceFinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamSpliceFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m Int64 | Returns: a |
Finishes an asynchronous stream splice operation.
write
data OutputStreamWriteMethodInfo Source #
Instances
(signature ~ (ByteString -> Maybe b -> m Int64), MonadIO m, IsOutputStream a, IsCancellable b) => OverloadedMethod OutputStreamWriteMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamWriteMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> ByteString |
|
-> Maybe b |
|
-> m Int64 | Returns: Number of bytes written, or -1 on error (Can throw |
Tries to write count
bytes from buffer
into the stream. Will block
during the operation.
If count is 0, returns 0 and does nothing. A value of count
larger than G_MAXSSIZE
will cause a IOErrorEnumInvalidArgument
error.
On success, the number of bytes written to the stream is returned.
It is not an error if this is not the same as the requested size, as it
can happen e.g. on a partial I/O error, or if there is not enough
storage in the stream. All writes block until at least one byte
is written or an error occurs; 0 is never returned (unless
count
is 0).
If cancellable
is not Nothing
, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error 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.
writeAll
data OutputStreamWriteAllMethodInfo Source #
Instances
(signature ~ (ByteString -> Maybe b -> m CSize), MonadIO m, IsOutputStream a, IsCancellable b) => OverloadedMethod OutputStreamWriteAllMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamWriteAllMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> ByteString |
|
-> Maybe b |
|
-> m CSize | (Can throw |
Tries to write count
bytes from buffer
into the stream. Will block
during the operation.
This function is similar to outputStreamWrite
, except it tries to
write as many bytes as requested, only stopping on an error.
On a successful write of count
bytes, True
is returned, and bytesWritten
is set to count
.
If there is an error during the operation False
is returned and error
is set to indicate the error status.
As a special exception to the normal conventions for functions that
use GError
, if this function returns False
(and sets error
) then
bytesWritten
will be set to the number of bytes that were
successfully written 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
outputStreamWrite
.
writeAllAsync
data OutputStreamWriteAllAsyncMethodInfo Source #
Instances
(signature ~ (ByteString -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsOutputStream a, IsCancellable b) => OverloadedMethod OutputStreamWriteAllAsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamWriteAllAsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamWriteAllAsync Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> ByteString |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Request an asynchronous write of count
bytes from buffer
into
the stream. When the operation is finished callback
will be called.
You can then call outputStreamWriteAllFinish
to get the result of the
operation.
This is the asynchronous version of outputStreamWriteAll
.
Call outputStreamWriteAllFinish
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 PRIORITY_DEFAULT
.
Note that no copy of buffer
will be made, so it must stay valid
until callback
is called.
Since: 2.44
writeAllFinish
data OutputStreamWriteAllFinishMethodInfo Source #
Instances
(signature ~ (b -> m CSize), MonadIO m, IsOutputStream a, IsAsyncResult b) => OverloadedMethod OutputStreamWriteAllFinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamWriteAllFinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamWriteAllFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m CSize | (Can throw |
Finishes an asynchronous stream write operation started with
outputStreamWriteAllAsync
.
As a special exception to the normal conventions for functions that
use GError
, if this function returns False
(and sets error
) then
bytesWritten
will be set to the number of bytes that were
successfully written 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
outputStreamWriteAsync
.
Since: 2.44
writeAsync
data OutputStreamWriteAsyncMethodInfo Source #
Instances
(signature ~ (Maybe ByteString -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsOutputStream a, IsCancellable b) => OverloadedMethod OutputStreamWriteAsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamWriteAsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamWriteAsync Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> Maybe ByteString |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Request an asynchronous write of count
bytes from buffer
into
the stream. When the operation is finished callback
will be called.
You can then call outputStreamWriteFinish
to get the result of the
operation.
During an async request no other sync and async calls are allowed,
and will result in IOErrorEnumPending
errors.
A value of count
larger than G_MAXSSIZE
will cause a
IOErrorEnumInvalidArgument
error.
On success, the number of bytes written 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. on a partial I/O error,
but generally we try to write as many bytes as requested.
You are guaranteed that this method will never fail with
IOErrorEnumWouldBlock
- if stream
can't accept more data, the
method will just wait until this changes.
Any outstanding I/O request with higher priority (lower numerical
value) will be executed before an outstanding request with lower
priority. Default priority is 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.
For the synchronous, blocking version of this function, see
outputStreamWrite
.
Note that no copy of buffer
will be made, so it must stay valid
until callback
is called. See outputStreamWriteBytesAsync
for a Bytes
version that will automatically hold a reference to
the contents (without copying) for the duration of the call.
writeBytes
data OutputStreamWriteBytesMethodInfo Source #
Instances
(signature ~ (Bytes -> Maybe b -> m Int64), MonadIO m, IsOutputStream a, IsCancellable b) => OverloadedMethod OutputStreamWriteBytesMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamWriteBytesMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamWriteBytes Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> Bytes |
|
-> Maybe b |
|
-> m Int64 | Returns: Number of bytes written, or -1 on error (Can throw |
A wrapper function for outputStreamWrite
which takes a
Bytes
as input. This can be more convenient for use by language
bindings or in other cases where the refcounted nature of Bytes
is helpful over a bare pointer interface.
However, note that this function may still perform partial writes,
just like outputStreamWrite
. If that occurs, to continue
writing, you will need to create a new Bytes
containing just the
remaining bytes, using bytesNewFromBytes
. Passing the same
Bytes
instance multiple times potentially can result in duplicated
data in the output stream.
writeBytesAsync
data OutputStreamWriteBytesAsyncMethodInfo Source #
Instances
(signature ~ (Bytes -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsOutputStream a, IsCancellable b) => OverloadedMethod OutputStreamWriteBytesAsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamWriteBytesAsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamWriteBytesAsync Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> Bytes |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
This function is similar to outputStreamWriteAsync
, but
takes a Bytes
as input. Due to the refcounted nature of Bytes
,
this allows the stream to avoid taking a copy of the data.
However, note that this function may still perform partial writes,
just like outputStreamWriteAsync
. If that occurs, to continue
writing, you will need to create a new Bytes
containing just the
remaining bytes, using bytesNewFromBytes
. Passing the same
Bytes
instance multiple times potentially can result in duplicated
data in the output stream.
For the synchronous, blocking version of this function, see
outputStreamWriteBytes
.
writeBytesFinish
data OutputStreamWriteBytesFinishMethodInfo Source #
Instances
(signature ~ (b -> m Int64), MonadIO m, IsOutputStream a, IsAsyncResult b) => OverloadedMethod OutputStreamWriteBytesFinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamWriteBytesFinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamWriteBytesFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m Int64 | Returns: a |
Finishes a stream write-from-tBytes
operation.
writeFinish
data OutputStreamWriteFinishMethodInfo Source #
Instances
(signature ~ (b -> m Int64), MonadIO m, IsOutputStream a, IsAsyncResult b) => OverloadedMethod OutputStreamWriteFinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamWriteFinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamWriteFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m Int64 | Returns: a |
Finishes a stream write operation.
writev
data OutputStreamWritevMethodInfo Source #
Instances
(signature ~ ([OutputVector] -> Maybe b -> m CSize), MonadIO m, IsOutputStream a, IsCancellable b) => OverloadedMethod OutputStreamWritevMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamWritevMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> [OutputVector] |
|
-> Maybe b |
|
-> m CSize | (Can throw |
Tries to write the bytes contained in the nVectors
vectors
into the
stream. Will block during the operation.
If nVectors
is 0 or the sum of all bytes in vectors
is 0, returns 0 and
does nothing.
On success, the number of bytes written to the stream is returned.
It is not an error if this is not the same as the requested size, as it
can happen e.g. on a partial I/O error, or if there is not enough
storage in the stream. All writes block until at least one byte
is written or an error occurs; 0 is never returned (unless
nVectors
is 0 or the sum of all bytes in vectors
is 0).
If cancellable
is not Nothing
, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error IOErrorEnumCancelled
will be returned. If an
operation was partially finished when the operation was cancelled the
partial result will be returned, without an error.
Some implementations of outputStreamWritev
may have limitations on the
aggregate buffer size, and will return IOErrorEnumInvalidArgument
if these
are exceeded. For example, when writing to a local file on UNIX platforms,
the aggregate buffer size must not exceed G_MAXSSIZE
bytes.
Since: 2.60
writevAll
data OutputStreamWritevAllMethodInfo Source #
Instances
(signature ~ ([OutputVector] -> Maybe b -> m CSize), MonadIO m, IsOutputStream a, IsCancellable b) => OverloadedMethod OutputStreamWritevAllMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamWritevAllMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamWritevAll Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> [OutputVector] |
|
-> Maybe b |
|
-> m CSize | (Can throw |
Tries to write the bytes contained in the nVectors
vectors
into the
stream. Will block during the operation.
This function is similar to outputStreamWritev
, except it tries to
write as many bytes as requested, only stopping on an error.
On a successful write of all nVectors
vectors, True
is returned, and
bytesWritten
is set to the sum of all the sizes of vectors
.
If there is an error during the operation False
is returned and error
is set to indicate the error status.
As a special exception to the normal conventions for functions that
use GError
, if this function returns False
(and sets error
) then
bytesWritten
will be set to the number of bytes that were
successfully written 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
outputStreamWrite
.
The content of the individual elements of vectors
might be changed by this
function.
Since: 2.60
writevAllAsync
data OutputStreamWritevAllAsyncMethodInfo Source #
Instances
(signature ~ ([OutputVector] -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsOutputStream a, IsCancellable b) => OverloadedMethod OutputStreamWritevAllAsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamWritevAllAsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamWritevAllAsync Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> [OutputVector] |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Request an asynchronous write of the bytes contained in the nVectors
vectors
into
the stream. When the operation is finished callback
will be called.
You can then call outputStreamWritevAllFinish
to get the result of the
operation.
This is the asynchronous version of outputStreamWritevAll
.
Call outputStreamWritevAllFinish
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 PRIORITY_DEFAULT
.
Note that no copy of vectors
will be made, so it must stay valid
until callback
is called. The content of the individual elements
of vectors
might be changed by this function.
Since: 2.60
writevAllFinish
data OutputStreamWritevAllFinishMethodInfo Source #
Instances
(signature ~ (b -> m CSize), MonadIO m, IsOutputStream a, IsAsyncResult b) => OverloadedMethod OutputStreamWritevAllFinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamWritevAllFinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamWritevAllFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m CSize | (Can throw |
Finishes an asynchronous stream write operation started with
outputStreamWritevAllAsync
.
As a special exception to the normal conventions for functions that
use GError
, if this function returns False
(and sets error
) then
bytesWritten
will be set to the number of bytes that were
successfully written 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
outputStreamWritevAsync
.
Since: 2.60
writevAsync
data OutputStreamWritevAsyncMethodInfo Source #
Instances
(signature ~ ([OutputVector] -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsOutputStream a, IsCancellable b) => OverloadedMethod OutputStreamWritevAsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamWritevAsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamWritevAsync Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> [OutputVector] |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Request an asynchronous write of the bytes contained in nVectors
vectors
into
the stream. When the operation is finished callback
will be called.
You can then call outputStreamWritevFinish
to get the result of the
operation.
During an async request no other sync and async calls are allowed,
and will result in IOErrorEnumPending
errors.
On success, the number of bytes written 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. on a partial I/O error,
but generally we try to write as many bytes as requested.
You are guaranteed that this method will never fail with
IOErrorEnumWouldBlock
— if stream
can't accept more data, the
method will just wait until this changes.
Any outstanding I/O request with higher priority (lower numerical
value) will be executed before an outstanding request with lower
priority. Default priority is 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.
For the synchronous, blocking version of this function, see
outputStreamWritev
.
Note that no copy of vectors
will be made, so it must stay valid
until callback
is called.
Since: 2.60
writevFinish
data OutputStreamWritevFinishMethodInfo Source #
Instances
(signature ~ (b -> m CSize), MonadIO m, IsOutputStream a, IsAsyncResult b) => OverloadedMethod OutputStreamWritevFinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.OutputStream Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo OutputStreamWritevFinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.OutputStream Methods |
outputStreamWritevFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsOutputStream a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m CSize | (Can throw |
Finishes a stream writev operation.
Since: 2.60