The source code demonstrates a basic principle of these two compression algorithms
[Download]
Note:
The LZW compression class is implemented as a fixed length code which you can specify, the huffman algorithm implementation encodes a byte into a variable length bit array. Both of them can work with streams.
I appreciate your questions ,suggestions and bug reports
:)