gi-gio-2.0.27: Gio bindings

Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gio.Objects.UnixOutputStream

Contents

- Exported types
- Methods
  - Overloaded methods
  - getCloseFd
  - getFd
  - new
  - setCloseFd
- Properties
  - closeFd
  - fd

Description

`UnixOutputStream` implements `OutputStream` for writing to a UNIX file descriptor, including asynchronous operations. (If the file descriptor refers to a socket or pipe, this will use `poll()` to do asynchronous I/O. If it refers to a regular file, it will fall back to doing asynchronous I/O in another thread.)

Note that `<gio/gunixoutputstream.h>` belongs to the UNIX-specific GIO interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config file when using it.

Synopsis

- newtype UnixOutputStream = UnixOutputStream (ManagedPtr UnixOutputStream)
- class (GObject o, IsDescendantOf UnixOutputStream o) => IsUnixOutputStream o
- toUnixOutputStream :: (MonadIO m, IsUnixOutputStream o) => o -> m UnixOutputStream
- unixOutputStreamGetCloseFd :: (HasCallStack, MonadIO m, IsUnixOutputStream a) => a -> m Bool
- unixOutputStreamGetFd :: (HasCallStack, MonadIO m, IsUnixOutputStream a) => a -> m Int32
- unixOutputStreamNew :: (HasCallStack, MonadIO m) => Int32 -> Bool -> m UnixOutputStream
- unixOutputStreamSetCloseFd :: (HasCallStack, MonadIO m, IsUnixOutputStream a) => a -> Bool -> m ()
- constructUnixOutputStreamCloseFd :: (IsUnixOutputStream o, MonadIO m) => Bool -> m (GValueConstruct o)
- getUnixOutputStreamCloseFd :: (MonadIO m, IsUnixOutputStream o) => o -> m Bool
- setUnixOutputStreamCloseFd :: (MonadIO m, IsUnixOutputStream o) => o -> Bool -> m ()
- constructUnixOutputStreamFd :: (IsUnixOutputStream o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getUnixOutputStreamFd :: (MonadIO m, IsUnixOutputStream o) => o -> m Int32

# Exported types

newtype UnixOutputStream Source #

Memory-managed wrapper type.

Constructors

UnixOutputStream (ManagedPtr UnixOutputStream) |

#### Instances

Instances details

Eq UnixOutputStream Source # |
Instance details Defined in GI.Gio.Objects.UnixOutputStream Methods (==) :: UnixOutputStream -> UnixOutputStream -> Bool # (/=) :: UnixOutputStream -> UnixOutputStream -> Bool #
GObject UnixOutputStream Source # |
Instance details Defined in GI.Gio.Objects.UnixOutputStream
TypedObject UnixOutputStream Source # |
Instance details Defined in GI.Gio.Objects.UnixOutputStream Methods glibType :: IO GType Source #
ManagedPtrNewtype UnixOutputStream Source # |
Instance details Defined in GI.Gio.Objects.UnixOutputStream Methods toManagedPtr :: UnixOutputStream -> ManagedPtr UnixOutputStream Source #
IsGValue UnixOutputStream Source # | Convert `UnixOutputStream` to and from `GValue` with `toGValue` and `fromGValue`.
Instance details Defined in GI.Gio.Objects.UnixOutputStream Methods toGValue :: UnixOutputStream -> IO GValue Source # fromGValue :: GValue -> IO UnixOutputStream Source #
HasParentTypes UnixOutputStream Source # |
Instance details Defined in GI.Gio.Objects.UnixOutputStream
type ParentTypes UnixOutputStream Source # |
Instance details Defined in GI.Gio.Objects.UnixOutputStream type ParentTypes UnixOutputStream = '[OutputStream, Object, FileDescriptorBased, PollableOutputStream]

class (GObject o, IsDescendantOf UnixOutputStream o) => IsUnixOutputStream o Source #

Type class for types which can be safely cast to `UnixOutputStream`, for instance with `toUnixOutputStream`.

#### Instances

Instances details

(GObject o, IsDescendantOf UnixOutputStream o) => IsUnixOutputStream o Source # |
Instance details Defined in GI.Gio.Objects.UnixOutputStream

toUnixOutputStream :: (MonadIO m, IsUnixOutputStream o) => o -> m UnixOutputStream Source #

Cast to `UnixOutputStream`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

## Overloaded methods

## getCloseFd

unixOutputStreamGetCloseFd Source #

Arguments

:: (HasCallStack, MonadIO m, IsUnixOutputStream a) |
=> a | `stream`: a `UnixOutputStream`
-> m Bool | Returns: `True` if the file descriptor is closed when done

Returns whether the file descriptor of `stream` will be closed when the stream is closed.

Since: 2.20

## getFd

unixOutputStreamGetFd Source #

Arguments

:: (HasCallStack, MonadIO m, IsUnixOutputStream a) |
=> a | `stream`: a `UnixOutputStream`
-> m Int32 | Returns: The file descriptor of `stream`

Return the UNIX file descriptor that the stream writes to.

Since: 2.20

## new

unixOutputStreamNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Int32 | `fd`: a UNIX file descriptor
-> Bool | `closeFd`: `True` to close the file descriptor when done
-> m UnixOutputStream | Returns: a new `OutputStream`

Creates a new `UnixOutputStream` for the given `fd`.

If `closeFd`, is `True`, the file descriptor will be closed when the output stream is destroyed.

## setCloseFd

unixOutputStreamSetCloseFd Source #

Arguments

:: (HasCallStack, MonadIO m, IsUnixOutputStream a) |
=> a | `stream`: a `UnixOutputStream`
-> Bool | `closeFd`: `True` to close the file descriptor when done
-> m () |

Sets whether the file descriptor of `stream` shall be closed when the stream is closed.

Since: 2.20

# Properties

## closeFd

Whether to close the file descriptor when the stream is closed.

Since: 2.20

constructUnixOutputStreamCloseFd :: (IsUnixOutputStream o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`close-fd`” property. This is rarely needed directly, but it is used by `new`.

getUnixOutputStreamCloseFd :: (MonadIO m, IsUnixOutputStream o) => o -> m Bool Source #

Get the value of the “`close-fd`” property. When overloading is enabled, this is equivalent to

    get unixOutputStream #closeFd

setUnixOutputStreamCloseFd :: (MonadIO m, IsUnixOutputStream o) => o -> Bool -> m () Source #

Set the value of the “`close-fd`” property. When overloading is enabled, this is equivalent to

    set unixOutputStream [ #closeFd := value ]

## fd

The file descriptor that the stream writes to.

Since: 2.20

constructUnixOutputStreamFd :: (IsUnixOutputStream o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`fd`” property. This is rarely needed directly, but it is used by `new`.

getUnixOutputStreamFd :: (MonadIO m, IsUnixOutputStream o) => o -> m Int32 Source #

Get the value of the “`fd`” property. When overloading is enabled, this is equivalent to

    get unixOutputStream #fd