unix-bytestring-0.4.0: Unix/Posix-specific functions for ByteStrings.
Copyright2010--2022 wren romano
LicenseBSD-3-Clause
Maintainerwren@cpan.org
Stabilityexperimental
Portabilitynon-portable (requires POSIX.1, XPG4.2)
Safe HaskellSafe-Inferred
LanguageHaskell2010

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 [ByteString]. 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.

Synopsis

I/O with file descriptors

Reading

fdRead Source #

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.

fdPread Source #

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

fdWrites Source #

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.

fdWritev Source #

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.