Safe Haskell | Safe-Inferred |
---|
Uuencoding is notoriously badly specified. This implementation is compatible with the GNU Sharutils (http://www.gnu.org/software/sharutils/).
Further documentation and information can be found at http://www.haskell.org/haskellwiki/Library/Data_encoding.
- data EncIncData
- data EncIncRes i
- = EPart i (EncIncData -> EncIncRes i)
- | EFinal i
- encodeInc :: EncIncData -> EncIncRes String
- encode :: [Word8] -> String
- data DecIncData i
- data DecIncRes i
- decodeInc :: DecIncData String -> DecIncRes String
- decode :: String -> Maybe [Word8]
- chop :: Int -> String -> [String]
- unchop :: [String] -> String
Documentation
data EncIncData Source
Data type for the incremental encoding functions.
Data type for the result of calling the incremental encoding functions.
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 |
encodeInc :: EncIncData -> EncIncRes StringSource
Incremental encoder function.
data DecIncData i Source
Data type for the incremental decoding functions.
Data type for the result of calling the incremental encoding functions.
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 |
DFail [Word8] i | a partial result for a failed decoding, together with the remainder of the data passed in so far |
Chop up a string in parts. Each string in the resulting list is prepended with the length according to the uuencode "specificiation".
Notes:
- The length of the strings in the result will be
(n -1)
. Thediv
4 * 4 + 1-1
comes from the need to prepend the length (which explains the final+1
). Keeping it to a multiple of 4 means that strings returned fromencode
can be chopped without requiring any changes. - The length of lines in GNU's sharutils is 61.