gi-gio-2.0.19: Gio bindings

Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com)
Safe Haskell | None
Language | Haskell2010

GI.Gio.Objects.UnixInputStream

Contents

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

Description

`UnixInputStream` implements `InputStream` for reading from 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/gunixinputstream.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 UnixInputStream = UnixInputStream (ManagedPtr UnixInputStream)
- class GObject o => IsUnixInputStream o
- toUnixInputStream :: (MonadIO m, IsUnixInputStream o) => o -> m UnixInputStream
- noUnixInputStream :: Maybe UnixInputStream
- unixInputStreamGetCloseFd :: (HasCallStack, MonadIO m, IsUnixInputStream a) => a -> m Bool
- unixInputStreamGetFd :: (HasCallStack, MonadIO m, IsUnixInputStream a) => a -> m Int32
- unixInputStreamNew :: (HasCallStack, MonadIO m) => Int32 -> Bool -> m UnixInputStream
- unixInputStreamSetCloseFd :: (HasCallStack, MonadIO m, IsUnixInputStream a) => a -> Bool -> m ()
- constructUnixInputStreamCloseFd :: IsUnixInputStream o => Bool -> IO (GValueConstruct o)
- getUnixInputStreamCloseFd :: (MonadIO m, IsUnixInputStream o) => o -> m Bool
- setUnixInputStreamCloseFd :: (MonadIO m, IsUnixInputStream o) => o -> Bool -> m ()
- constructUnixInputStreamFd :: IsUnixInputStream o => Int32 -> IO (GValueConstruct o)
- getUnixInputStreamFd :: (MonadIO m, IsUnixInputStream o) => o -> m Int32

# Exported types

newtype UnixInputStream Source #

Memory-managed wrapper type.

Constructors

UnixInputStream (ManagedPtr UnixInputStream) |

Instances

GObject UnixInputStream Source # |
Instance details Defined in GI.Gio.Objects.UnixInputStream Methods gobjectType :: UnixInputStream -> IO GType Source #
IsObject UnixInputStream Source # |
Instance details Defined in GI.Gio.Objects.UnixInputStream
IsFileDescriptorBased UnixInputStream Source # |
Instance details Defined in GI.Gio.Objects.UnixInputStream
IsPollableInputStream UnixInputStream Source # |
Instance details Defined in GI.Gio.Objects.UnixInputStream
IsInputStream UnixInputStream Source # |
Instance details Defined in GI.Gio.Objects.UnixInputStream
IsUnixInputStream UnixInputStream Source # |
Instance details Defined in GI.Gio.Objects.UnixInputStream

class GObject o => IsUnixInputStream o Source #

Type class for types which can be safely cast to `UnixInputStream`, for instance with `toUnixInputStream`.

Instances

(GObject a, (UnknownAncestorError UnixInputStream a :: Constraint)) => IsUnixInputStream a Source # |
Instance details Defined in GI.Gio.Objects.UnixInputStream
IsUnixInputStream UnixInputStream Source # |
Instance details Defined in GI.Gio.Objects.UnixInputStream

toUnixInputStream :: (MonadIO m, IsUnixInputStream o) => o -> m UnixInputStream Source #

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

noUnixInputStream :: Maybe UnixInputStream Source #

A convenience alias for `Nothing` :: `Maybe` `UnixInputStream`.

# Methods

## getCloseFd

unixInputStreamGetCloseFd Source #

Arguments

:: (HasCallStack, MonadIO m, IsUnixInputStream a) |
=> a | `stream`: a `UnixInputStream`
-> 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

unixInputStreamGetFd Source #

Arguments

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

Return the UNIX file descriptor that the stream reads from.

Since: 2.20

## new

unixInputStreamNew Source #

Arguments

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

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

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

## setCloseFd

unixInputStreamSetCloseFd Source #

Arguments

:: (HasCallStack, MonadIO m, IsUnixInputStream a) |
=> a | `stream`: a `UnixInputStream`
-> 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

constructUnixInputStreamCloseFd :: IsUnixInputStream o => Bool -> IO (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`.

getUnixInputStreamCloseFd :: (MonadIO m, IsUnixInputStream o) => o -> m Bool Source #

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

    get unixInputStream #closeFd

setUnixInputStreamCloseFd :: (MonadIO m, IsUnixInputStream o) => o -> Bool -> m () Source #

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

    set unixInputStream [ #closeFd := value ]

## fd

The file descriptor that the stream reads from.

Since: 2.20

constructUnixInputStreamFd :: IsUnixInputStream o => Int32 -> IO (GValueConstruct o) Source #

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

getUnixInputStreamFd :: (MonadIO m, IsUnixInputStream o) => o -> m Int32 Source #

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

    get unixInputStream #fd