io-streams-1.1.4.6: Simple, composable, and easy-to-use stream I/O

Safe HaskellTrustworthy

System.IO.Streams.Handle

Contents

Description

Input and output streams for file Handles.

Synopsis

Handle conversions

handleToInputStream :: Handle -> IO (InputStream ByteString)Source

Converts a read-only handle into an InputStream of strict ByteStrings.

Note that the wrapped handle is not closed when it yields end-of-stream; you can use atEndOfInput to close the handle if you would like this behaviour.

handleToOutputStream :: Handle -> IO (OutputStream ByteString)Source

Converts a writable handle into an OutputStream of strict ByteStrings.

Note that the wrapped handle is not closed when it receives end-of-stream; you can use atEndOfOutput to close the handle if you would like this behaviour.

inputStreamToHandle :: InputStream ByteString -> IO HandleSource

Converts an InputStream over bytestrings to a read-only Handle. Note that the generated handle is opened unbuffered in binary mode (i.e. no newline translation is performed).

Note: the InputStream passed into this function is wrapped in lockingInputStream to make it thread-safe.

Since: 1.0.2.0.

outputStreamToHandle :: OutputStream ByteString -> IO HandleSource

Converts an OutputStream over bytestrings to a write-only Handle. Note that the Handle will be opened in non-buffering mode; if you buffer the OutputStream using the Handle buffering then io-streams will copy the Handle buffer when sending ByteString values to the output, which might not be what you want. When the output buffer, if used, is flushed, an empty string is written to the output, as is conventional throughout the io-streams library for ByteString output buffers.

Note: the OutputStream passed into this function is wrapped in lockingOutputStream to make it thread-safe.

Since: 1.0.2.0.

streamPairToHandle :: InputStream ByteString -> OutputStream ByteString -> IO HandleSource

Converts a pair of InputStream and OutputStream over bytestrings to a read-write Handle.

Note: the streams passed into this function are wrapped in locking primitives to make them thread-safe.

Since: 1.0.2.0.

Standard system handles