dataenc-0.14.0.4: Data encoding library

Safe HaskellSafe-Inferred

Codec.Binary.Base64

Description

Implemented as specified in RFC 4648 (http://tools.ietf.org/html/rfc4648).

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

Synopsis

Documentation

data EncIncData Source

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 Source

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 StringSource

Incremental encoder function.

encode :: [Word8] -> StringSource

Encode data.

data DecIncData i Source

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 Source

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 String -> DecIncRes StringSource

Incremental decoder function.

decode :: String -> Maybe [Word8]Source

Decode data.

chopSource

Arguments

:: Int

length of individual lines

-> String 
-> [String] 

Chop up a string in parts.

The length given is rounded down to the nearest multiple of 4.

Notes:

  • PEM requires lines that are 64 characters long.
  • MIME requires lines that are at most 76 characters long.

unchop :: [String] -> StringSource

Concatenate the strings into one long string.