Codec.Binary.Yenc

dataenc-0.14.0.7: Data encoding library

Copyright | (c) 2007 Magnus Therning
License | BSD3
Safe Haskell | Safe
Language | Haskell98

Codec.Binary.Yenc

Description

Implementation based on the specification found at http://yence.sourceforge.net/docs/protocol/version1_3_draft.html.

Further documentation and information can be found at http://www.haskell.org/haskellwiki/Library/Data_encoding.

Synopsis

- data EncIncData
  - = EChunk [Word8]
  - | EDone
- data EncIncRes i
  - = EPart i (EncIncData -> EncIncRes i)
  - | EFinal i
- encodeInc :: EncIncData -> EncIncRes [Word8]
- encode :: [Word8] -> [Word8]
- data DecIncData i
  - = DChunk i
  - | DDone
- data DecIncRes i
  - = DPart [Word8] (DecIncData i -> DecIncRes i)
  - | DFinal [Word8] i
  - | DFail [Word8] i
- decodeInc :: DecIncData [Word8] -> DecIncRes [Word8]
- decode :: [Word8] -> Maybe [Word8]
- chop :: Int -> [Word8] -> [[Word8]]
- unchop :: [[Word8]] -> [Word8]

# Documentation

data EncIncData

Data type for the incremental encoding functions.

Constructors

EChunk [Word8] | a chunk of data to be encoded
EDone | the signal to the encoder that the stream of data is ending

data EncIncRes i

Data type for the result of calling the incremental encoding functions.

Constructors

EPart i (EncIncData -> EncIncRes i) | a partial result together with the continuation to use for further encoding
EFinal i | the final result of encoding (the response to `EDone`)

encodeInc :: EncIncData -> EncIncRes [Word8]

Incremental encoder function.

encode :: [Word8] -> [Word8]

Encode data.

data DecIncData i

Data type for the incremental decoding functions.

Constructors

DChunk i | a chunk of data to be decoded
DDone | the signal to the decoder that the stream of data is ending

data DecIncRes i

Data type for the result of calling the incremental encoding functions.

Constructors

DPart [Word8] (DecIncData i -> DecIncRes i) | a partial result together with the continuation to user for further decoding
DFinal [Word8] i | the final result of decoding (the response to `DDone`)
DFail [Word8] i | a partial result for a failed decoding, together with the remainder of the data passed in so far

decodeInc :: DecIncData [Word8] -> DecIncRes [Word8]

Incremental decoder function.

decode :: [Word8] -> Maybe [Word8]

Decode data.

chop

Arguments

:: Int | length of individual lines
-> [Word8] |
-> [[Word8]] |

Chop up a string in parts.

unchop :: [[Word8]] -> [Word8]

Concatenate the strings into one long string.