Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HuffmanDecode ¶
HuffmanDecode decodes an encoded string by HuffmanEncode function.
It receives a byte sequence and a map[byte]string Code table. This parameters is returned by HuffmanEncode function. It also returns a byte sequence for the passed encoded byte sequence
Types ¶
type Code ¶
Code is a map used to store got symbols and respective huffman codes
func HuffmanEncode ¶
HuffmanEncode compresses the passed data with the Huffman Coding algorithm. It returns a byte slice with encoded data and the table of in codes. example:
compress.HuffmanEncode([]byte("AAAABBBCCD")) returns:
[ '1' '1' '1' '1' '0' '0' '0' '0' '0' '0'
'0' '1' '0' '0' '1' '0' '0' '1' '1' ]
map['A': "1", 'B': "00", 'C': "010", 'D', "011"]
The map can be used for decode the encoded byte sequence