binary-conduit-1.3: data serialization/deserialization conduit library

Safe HaskellNone
LanguageHaskell98

Data.Conduit.Serialization.Binary

Synopsis

Documentation

conduitDecode :: (Binary b, MonadThrow m) => ConduitT ByteString b m () Source #

Runs default Decoder repeatedly on a input stream.

conduitEncode :: (Binary b, MonadThrow m) => ConduitT b ByteString m () Source #

Runs default encoder on a input stream.

This function produces a stream of bytes where for each input value you will have a number of ByteStrings, and no boundary between different values.

conduitMsgEncode :: Monad m => Binary b => ConduitT b ByteString m () Source #

Runs default encoder on input stream.

This function produces a ByteString per each incomming packet, it may be useful in datagram based protocols. Function maintains following property

  'conduitMsgEncode' xs == 'CL.map' 'Data.ByteString.encode' =$= 'CL.map' 'LBS.toStrict'

This invariant is maintaind by the cost of additional data copy, so if you packets can be serialized to the large data chunks or you interested in iterative packet serialization concider using conduitPutList or conduitPutMany

conduitGet :: MonadThrow m => Get b -> ConduitT ByteString b m () Source #

Runs getter repeatedly on a input stream.

conduitPut :: Monad m => ConduitT Put ByteString m () Source #

Runs putter repeatedly on a input stream, returns an output stream.

conduitPutList :: Monad m => ConduitT Put [ByteString] m () Source #

Vectorized variant of conduitPut returning list contains all chunks from one element representation

conduitPutLBS :: Monad m => ConduitT Put ByteString m () Source #

Runs putter repeatedly on a input stream. Returns a lazy butestring so it's possible to use vectorized IO on the result either by calling' LBS.toChunks' or by calling send.

conduitPutMany :: Monad m => ConduitT Put (Vector ByteString) m () Source #

Vectorized variant of conduitPut.

sourcePut :: Monad m => Put -> ConduitT z ByteString m () Source #

Create stream of strict bytestrings from Put value.

sinkGet :: MonadThrow m => Get b -> ConduitT ByteString z m b Source #

Decode message from input stream.

data ParseError Source #

Constructors

ParseError 

Fields