Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (inaki@blueleaf.cc) |
Safe Haskell | None |
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
- noFileIOStream :: Maybe FileIOStream
- fileIOStreamGetEtag :: (HasCallStack, MonadIO m, IsFileIOStream a) => a -> m 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
GObject FileIOStream Source # | |
Defined in GI.Gio.Objects.FileIOStream gobjectType :: IO GType # | |
HasParentTypes FileIOStream Source # | |
Defined in GI.Gio.Objects.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
.
noFileIOStream :: Maybe FileIOStream Source #
A convenience alias for Nothing
:: Maybe
FileIOStream
.
Methods
getEtag
:: (HasCallStack, MonadIO m, IsFileIOStream a) | |
=> a |
|
-> m 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