Safe Haskell | Trustworthy |
---|
Input and output streams for file Handle
s.
- handleToInputStream :: Handle -> IO (InputStream ByteString)
- handleToOutputStream :: Handle -> IO (OutputStream ByteString)
- inputStreamToHandle :: InputStream ByteString -> IO Handle
- outputStreamToHandle :: OutputStream ByteString -> IO Handle
- streamPairToHandle :: InputStream ByteString -> OutputStream ByteString -> IO Handle
- stdin :: InputStream ByteString
- stdout :: OutputStream ByteString
- stderr :: OutputStream ByteString
Handle conversions
handleToInputStream :: Handle -> IO (InputStream ByteString)Source
Converts a read-only handle into an InputStream
of strict ByteString
s.
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 ByteString
s.
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
stdin :: InputStream ByteStringSource
An InputStream
for stdin
.
stdout :: OutputStream ByteStringSource
An OutputStream
for stdout
.
stderr :: OutputStream ByteStringSource
An OutputStream
for stderr
.