binary-streams-0.1.0.1: data serialization/deserialization io-streams library

Safe HaskellNone
LanguageHaskell2010

System.IO.Streams.Binary

Contents

Synopsis

Decoding

binaryFromStream :: Binary a => InputStream ByteString -> IO (Maybe a) Source

Read an instance of Binary from an InputStream, throwing a DecodeException if the decoding fails.

binaryFromStream consumes only as much input as necessary: any unconsumed input is pushed back onto the InputStream.

binaryInputStream :: Binary a => InputStream ByteString -> IO (InputStream a) Source

Transform an InputStream over byte strings to an InputStream yielding values of type a, throwing a DecodeException if the decoding fails.

Encoding

binaryToStream :: Binary a => OutputStream ByteString -> Maybe a -> IO () Source

Write an instance of Binary to an InputStream.

binaryOutputStream :: Binary a => OutputStream ByteString -> IO (OutputStream a) Source

Transform an OutputStream accepting byte strings to an OutputStream accepting values of type a.

Decode Exceptions

data DecodeException Source

An Exception raised when decoding fails.