Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
GFileIOStream provides io streams that both read and write to the same file handle.
GFileIOStream implements Seekable
, which allows the io
stream to jump to arbitrary positions in the file and to truncate
the file, provided the filesystem of the file supports these
operations.
To find the position of a file io stream, use
seekableTell
.
To find out if a file io stream supports seeking, use seekableCanSeek
.
To position a file io stream, use seekableSeek
.
To find out if a file io stream supports truncating, use
seekableCanTruncate
. To truncate a file io
stream, use seekableTruncate
.
The default implementation of all the FileIOStream
operations
and the implementation of Seekable
just call into the same operations
on the output stream.
Since: 2.22
Synopsis
- newtype FileIOStream = FileIOStream (ManagedPtr FileIOStream)
- class (GObject o, IsDescendantOf FileIOStream o) => IsFileIOStream o
- toFileIOStream :: (MonadIO m, IsFileIOStream o) => o -> m FileIOStream
- fileIOStreamGetEtag :: (HasCallStack, MonadIO m, IsFileIOStream a) => a -> m (Maybe Text)
- fileIOStreamQueryInfo :: (HasCallStack, MonadIO m, IsFileIOStream a, IsCancellable b) => a -> Text -> Maybe b -> m FileInfo
- fileIOStreamQueryInfoAsync :: (HasCallStack, MonadIO m, IsFileIOStream a, IsCancellable b) => a -> Text -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- fileIOStreamQueryInfoFinish :: (HasCallStack, MonadIO m, IsFileIOStream a, IsAsyncResult b) => a -> b -> m FileInfo
Exported types
newtype FileIOStream Source #
Memory-managed wrapper type.
Instances
Eq FileIOStream Source # | |
Defined in GI.Gio.Objects.FileIOStream (==) :: FileIOStream -> FileIOStream -> Bool # (/=) :: FileIOStream -> FileIOStream -> Bool # | |
GObject FileIOStream Source # | |
Defined in GI.Gio.Objects.FileIOStream | |
ManagedPtrNewtype FileIOStream Source # | |
Defined in GI.Gio.Objects.FileIOStream | |
TypedObject FileIOStream Source # | |
Defined in GI.Gio.Objects.FileIOStream | |
HasParentTypes FileIOStream Source # | |
Defined in GI.Gio.Objects.FileIOStream | |
IsGValue (Maybe FileIOStream) Source # | Convert |
Defined in GI.Gio.Objects.FileIOStream gvalueGType_ :: IO GType # gvalueSet_ :: Ptr GValue -> Maybe FileIOStream -> IO () # gvalueGet_ :: Ptr GValue -> IO (Maybe FileIOStream) # | |
type ParentTypes FileIOStream Source # | |
Defined in GI.Gio.Objects.FileIOStream |
class (GObject o, IsDescendantOf FileIOStream o) => IsFileIOStream o Source #
Type class for types which can be safely cast to FileIOStream
, for instance with toFileIOStream
.
Instances
(GObject o, IsDescendantOf FileIOStream o) => IsFileIOStream o Source # | |
Defined in GI.Gio.Objects.FileIOStream |
toFileIOStream :: (MonadIO m, IsFileIOStream o) => o -> m FileIOStream Source #
Cast to FileIOStream
, 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, canSeek, canTruncate, clearPending, close, closeAsync, closeFinish, forceFloating, freezeNotify, getv, hasPending, isClosed, isFloating, notify, notifyByPspec, queryInfo, queryInfoAsync, queryInfoFinish, ref, refSink, runDispose, seek, spliceAsync, stealData, stealQdata, tell, thawNotify, truncate, unref, watchClosure.
Getters
getData, getEtag, getInputStream, getOutputStream, getProperty, getQdata.
Setters
getEtag
:: (HasCallStack, MonadIO m, IsFileIOStream a) | |
=> a |
|
-> m (Maybe Text) | Returns: the entity tag for the stream. |
Gets the entity tag for the file when it has been written. This must be called after the stream has been written and closed, as the etag can change while writing.
Since: 2.22
queryInfo
fileIOStreamQueryInfo Source #
:: (HasCallStack, MonadIO m, IsFileIOStream a, IsCancellable b) | |
=> a |
|
-> Text |
|
-> Maybe b |
|
-> m FileInfo | Returns: a |
Queries a file io stream for the given attributes
.
This function blocks while querying the stream. For the asynchronous
version of this function, see fileIOStreamQueryInfoAsync
.
While the stream is blocked, the stream will set the pending flag
internally, and any other operations on the stream will fail with
IOErrorEnumPending
.
Can fail if the stream was already closed (with error
being set to
IOErrorEnumClosed
), the stream has pending operations (with error
being
set to IOErrorEnumPending
), or if querying info is not supported for
the stream's interface (with error
being set to IOErrorEnumNotSupported
). I
all cases of failure, Nothing
will be returned.
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 set, and Nothing
will
be returned.
Since: 2.22
queryInfoAsync
fileIOStreamQueryInfoAsync Source #
:: (HasCallStack, MonadIO m, IsFileIOStream a, IsCancellable b) | |
=> a |
|
-> Text |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Asynchronously queries the stream
for a FileInfo
. When completed,
callback
will be called with a AsyncResult
which can be used to
finish the operation with fileIOStreamQueryInfoFinish
.
For the synchronous version of this function, see
fileIOStreamQueryInfo
.
Since: 2.22
queryInfoFinish
fileIOStreamQueryInfoFinish Source #
:: (HasCallStack, MonadIO m, IsFileIOStream a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m FileInfo | Returns: A |
Finalizes the asynchronous query started
by fileIOStreamQueryInfoAsync
.
Since: 2.22