gi-gio-2.0.35: Gio bindings

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

GI.Gio.Objects.FileIOStream

Contents

- Exported types
- Methods
  - getEtag
  - queryInfo
  - queryInfoAsync
  - queryInfoFinish

Description

`GFileIOStream` provides I/O streams that both read and write to the same file handle.

`GFileIOStream` implements `Seekable`, which allows the I/O 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 I/O stream, use `seekableTell`.

To find out if a file I/O stream supports seeking, use `seekableCanSeek`. To position a file I/O stream, use `seekableSeek`. To find out if a file I/O stream supports truncating, use `seekableCanTruncate`. To truncate a file I/O stream, use `seekableTruncate`.

The default implementation of all the `GFileIOStream` 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.

Constructors

FileIOStream (ManagedPtr FileIOStream) |

#### Instances

Instances details

Eq FileIOStream Source # |
Instance details Defined in GI.Gio.Objects.FileIOStream Methods (==) :: FileIOStream -> FileIOStream -> Bool Source # (/=) :: FileIOStream -> FileIOStream -> Bool Source #
GObject FileIOStream Source # |
Instance details Defined in GI.Gio.Objects.FileIOStream
ManagedPtrNewtype FileIOStream Source # |
Instance details Defined in GI.Gio.Objects.FileIOStream Methods toManagedPtr :: FileIOStream -> ManagedPtr FileIOStream Source #
TypedObject FileIOStream Source # |
Instance details Defined in GI.Gio.Objects.FileIOStream Methods glibType :: IO GType Source #
HasParentTypes FileIOStream Source # |
Instance details Defined in GI.Gio.Objects.FileIOStream
IsGValue (Maybe FileIOStream) Source # | Convert `FileIOStream` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gio.Objects.FileIOStream Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe FileIOStream -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe FileIOStream) Source #
type ParentTypes FileIOStream Source # |
Instance details Defined in GI.Gio.Objects.FileIOStream type ParentTypes FileIOStream = '[IOStream, Object, Seekable]

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

Instances details

(GObject o, IsDescendantOf FileIOStream o) => IsFileIOStream o Source # |
Instance details 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

Expand

#### 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

setData, setDataFull, setPending, setProperty.

## getEtag

fileIOStreamGetEtag Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileIOStream a) |
=> a | `stream`: a `FileIOStream`.
-> 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 #

Arguments

:: (HasCallStack, MonadIO m, IsFileIOStream a, IsCancellable b) |
=> a | `stream`: a `FileIOStream`.
-> Text | `attributes`: a file attribute query string.
-> Maybe b | `cancellable`: optional `Cancellable` object, `Nothing` to ignore.
-> m FileInfo | Returns: a `FileInfo` for the `stream`, or `Nothing` on error. (Can throw `GError`)

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 #

Arguments

:: (HasCallStack, MonadIO m, IsFileIOStream a, IsCancellable b) |
=> a | `stream`: a `FileIOStream`.
-> Text | `attributes`: a file attribute query string.
-> Int32 | `ioPriority`: the I/O priority of the request
-> Maybe b | `cancellable`: optional `Cancellable` object, `Nothing` to ignore.
-> Maybe AsyncReadyCallback | `callback`: a `AsyncReadyCallback` to call when the request is satisfied
-> 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 #

Arguments

:: (HasCallStack, MonadIO m, IsFileIOStream a, IsAsyncResult b) |
=> a | `stream`: a `FileIOStream`.
-> b | `result`: a `AsyncResult`.
-> m FileInfo | Returns: A `FileInfo` for the finished query. (Can throw `GError`)

Finalizes the asynchronous query started by `fileIOStreamQueryInfoAsync`.

Since: 2.22