On 8/10/06, jhakim <[EMAIL PROTECTED]> wrote:

There is a great port of the JAVA compression package to .NET. Check out
http://www.icsharpcode.net/OpenSource/SharpZipLib/.

Using the .NET port the uncompression is comething like:

                private static byte[] Inflate(byte[] bytes)
                {
                        MemoryStream mis = new MemoryStream();
                        mis.Write(bytes, 0, bytes.Length);
                        mis.Flush();
                        mis.Position = 0;
                        Stream ins = new GZipInputStream(mis);

                        MemoryStream mos = new MemoryStream();
                        byte[] buf = new byte[102400];
                        while (true)
                        {
                                int count = ins.Read(buf, 0, buf.Length);
                                if (count == 0)
                                        break;
                                mos.Write(buf, 0, count);
                        }
                        ins.Close();
                        mos.Position = 0;
                        byte[] uncompressedBytes = new byte[mos.Length];
                        mos.Read(uncompressedBytes, 0, 
uncompressedBytes.Length);
                        mos.Close();

                        return uncompressedBytes;
                }


In the case of the bond trading sysetm that I am working on compression is
required only from the server (java) to client (.NET). I am sure that
compression code in .NET is pretty straightforward as well.

Great, thanks!

Unfortunately that library is GPL so I'm afraid we can't use it though.
http://people.apache.org/~cliffs/3party.html

I wonder if they'd dual licence it?

--

James
-------
http://radio.weblogs.com/0112098/

Reply via email to