I'm looking for a LZW compression algorithm in C# that takes a "string" and returns a string. I've googling for hours and all I've found use MemoryStream, BinaryWriters, etc.
I just want to be able to do something like:
string _data = "12345";
string _result = CompressToLZW(_data);
and then pass that string via Ajax to the browser. I already have the LZW decompression algorithm for javascript (http://rosettacode.org/wiki/LZW_compression#JavaScript)
Thanks.-
UPDATE:
This is the code I'm using right now with http://paste.lisp.org/display/12198
string _data = "12345_12345_12345_12345";
byte[] byteArray = Encoding.ASCII.GetBytes(_data);
MemoryStream _st = new MemoryStream(byteArray);
StreamReader _sr = new StreamReader(_st);
MemoryStream streamoutput = new MemoryStream();
BinaryWriter _output= new BinaryWriter(streamoutput);
LZW.Compress(_sr, _output);
string _res = (new StreamReader(_output.BaseStream)).ReadToEnd();
return _res;
UPDATE 2 I found a source code in C# that does the work at http://code.google.com/p/sharp-lzw/source/browse/ Thanks.-