gi-gio-2.0.29: Gio bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gio.Objects.FileIOStream

Description

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

Exported types

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

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][gio-GIOScheduler] of the request

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: callback 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