News SF.net Project Frequently Asked Questions Documentation Downloads Mailing Lists How to Contribute

SourceForge.net Logo

Changing the way games are made and played.

TNL::HuffmanStringProcessor Namespace Reference

TNL::HuffmanStringProcessor Namespace Reference


Detailed Description

HuffmanStringProcessor does Huffman coding on strings written into BitStream objects.


Functions

bool readHuffBuffer (BitStream *pStream, char *out_pBuffer)
 Reads a Huffman compressed string out of a BitStream.

bool writeHuffBuffer (BitStream *pStream, const char *out_pBuffer, U32 maxLen)
 Writes and Huffman compresses a string into a BitStream.


Function Documentation

bool readHuffBuffer BitStream *  pStream,
char *  out_pBuffer
 

Reads a Huffman compressed string out of a BitStream.

bool writeHuffBuffer BitStream *  pStream,
const char *  out_pBuffer,
U32  maxLen
 

Writes and Huffman compresses a string into a BitStream.

Parameters:
pStream Stream to output compressed data to.
out_pBuffer String to compress.
maxLen Maximum length of the string. If string length exceeds this, then the string is terminated early.
Note:
The Huffman encoder uses BitStream::writeString as a fallback. WriteString can only write strings of up to 255 characters length. Therefore, it is wise not to exceed that limit.