text-stream-decode-0.1.0.5: Streaming decoding functions for UTF encodings. (deprecated)

Safe HaskellNone

Data.Text.StreamDecoding

Contents

Description

Provides a stream-based approach to decoding Unicode data. Each function below works the same way: you give it a chunk of data, and it gives back a DecodeResult. If the parse was a success, then you get a chunk of Text (possibly empty) and a continuation parsing function. If the parse was a failure, you get a chunk of successfully decoded Text (possibly empty) and the unconsumed bytes.

In order to indicate end of stream, you pass an empty ByteString to the decode function. This call may result in a failure, if there were unused bytes left over from a previous step which formed part of a code sequence.

Synopsis

Streaming

streamUtf8 :: ByteString -> DecodeResultSource

O(n) Convert a lazy ByteString into a 'Stream Char', using UTF-8 encoding.

streamUtf8Pure :: ByteString -> DecodeResultSource

O(n) Convert a lazy ByteString into a 'Stream Char', using UTF-8 encoding.

streamUtf16LE :: ByteString -> DecodeResultSource

O(n) Convert a ByteString into a 'Stream Char', using little endian UTF-16 encoding.

streamUtf16BE :: ByteString -> DecodeResultSource

O(n) Convert a ByteString into a 'Stream Char', using big endian UTF-16 encoding.

streamUtf32LE :: ByteString -> DecodeResultSource

O(n) Convert a ByteString into a 'Stream Char', using little endian UTF-32 encoding.

streamUtf32BE :: ByteString -> DecodeResultSource

O(n) Convert a ByteString into a 'Stream Char', using big endian UTF-32 encoding.

Type