| Copyright | 2010--2022 wren romano |
|---|---|
| License | BSD-3-Clause |
| Maintainer | [email protected] |
| Stability | experimental |
| Portability | non-portable (requires POSIX.1, XPG4.2) |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
System.Posix.IO.ByteString.Ext.Lazy
Description
Provides a lazy-ByteString variant of System.Posix.IO.ByteString.Ext,
to avoid boilerplate code for converting between lazy-ByteString
and strict [. This module was renamed in
version 0.4.0 to mirror the renaming of the strict module.
See the documentation there for the reason why.ByteString]
Synopsis
- fdRead :: Fd -> ByteCount -> IO ByteString
- fdPread :: Fd -> ByteCount -> FileOffset -> IO ByteString
- fdWrites :: Fd -> ByteString -> IO (ByteCount, ByteString)
- fdWritev :: Fd -> ByteString -> IO ByteCount
I/O with file descriptors
Reading
Arguments
| :: Fd | |
| -> ByteCount | How many bytes to try to read. |
| -> IO ByteString | The bytes read. |
Read data from an Fd and convert it to a ByteString.
Throws an exception if this is an invalid descriptor, or EOF has
been reached. This is a thin wrapper around fdRead.
Arguments
| :: Fd | |
| -> ByteCount | How many bytes to try to read. |
| -> FileOffset | Where to read the data from. |
| -> IO ByteString | The bytes read. |
Read data from a specified position in the Fd and convert
it to a ByteString, without altering the position stored
in the Fd. Throws an exception if this is an invalid descriptor,
or EOF has been reached. This is a thin wrapper around
fdPread.
Since: 0.3.1
Writing
Arguments
| :: Fd | |
| -> ByteString | The string to write. |
| -> IO (ByteCount, ByteString) | How many bytes were actually written, and the remaining (unwritten) string. |
Write a ByteString to an Fd. This function makes one
write(2) system call per chunk, as per fdWrites.
Arguments
| :: Fd | |
| -> ByteString | The string to write. |
| -> IO ByteCount | How many bytes were actually written. |
Write a ByteString to an Fd. This function makes a
single writev(2) system call, as per fdWritev.