sandi-0.3.6: Data encoding library

Copyright(c) 2012 Magnus Therning
LicenseBSD3
Safe HaskellNone
LanguageHaskell98

Codec.Binary.Xx

Description

Xxencoding is obsolete but still included for completeness. Further information on the encoding can be found at http://en.wikipedia.org/wiki/Xxencode. It should be noted that this implementation performs no padding.

This encoding is very similar to uuencoding, therefore further information regarding the functions can be found in the documentation of Codec.Binary.Uu.

Synopsis

Documentation

xx_encode_part :: ByteString -> (ByteString, ByteString) Source

Encoding function.

>>> xx_encode_part $ Data.ByteString.Char8.pack "foo"
("Naxj","")
>>> xx_encode_part $ Data.ByteString.Char8.pack "foob"
("Naxj","b")

xx_encode_final :: ByteString -> Maybe ByteString Source

Encoding function for the final block.

>>> xx_encode_final $ Data.ByteString.Char8.pack "r"
Just "QU"
>>> xx_encode_final $ Data.ByteString.Char8.pack "foo"
Nothing

xx_decode_part :: ByteString -> Either (ByteString, ByteString) (ByteString, ByteString) Source

Decoding function.

>>> xx_decode_part $ Data.ByteString.Char8.pack "Naxj"
Right ("foo","")
>>> xx_decode_part $ Data.ByteString.Char8.pack "NaxjMa3"
Right ("foo","Ma3")
>>> xx_decode_part $ Data.ByteString.Char8.pack "Na j"
Left ("","Na J")

xx_decode_final :: ByteString -> Maybe ByteString Source

Decoding function for the final block.

>>> xx_decode_final $ Data.ByteString.Char8.pack "Naw"
Just "fo"
>>> xx_decode_final $ Data.ByteString.Char8.pack ""
Just ""
>>> xx_decode_final $ Data.ByteString.Char8.pack "Na "
Nothing
>>> xx_decode_final $ encode $ Data.ByteString.Char8.pack "foo"
Nothing