I am writing an xmpp library and I am trying to write a stream to support the zlib compressed data. I have two different versions one based on zlib.net and the other using SharpZipLib. The zlib.net version doesn't recognize the compression and the SharpZipLib version enters an infinite loop. You can find the appropriate code at http://github.com/coder2000/ubiety/tree/master/ in xmpp.compression.zlib and xmpp.compression.sharpziplib. Any help to solve this problem would be appreciated.
+1
A:
No. I am trying to be as cross platform as possible. I don't know if Mono implements those classes and I didn't know Microsoft wrote classes for zlib compression.
Coder2000
2008-12-01 00:19:01
They are both based on industry standards, and should work for you.
StingyJack
2008-12-01 01:48:59
@Coder2000 - you just posted an answer, not a question. Add these comments to your original question.
Jason Jackson
2008-12-01 03:39:36
A:
I haven't looked in depth, but it is curious that your SharpZipLib wrapper ignores offset
and count
in BeginRead:
public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback cback, object state)
{
_outBuff = buffer;
if ( _in.IsNeedingInput )
return _innerStream.BeginRead(_inBuff, 0, _inBuff.Length, cback, state);
ZlibStreamAsyncResult ar = new ZlibStreamAsyncResult(state);
cback(ar);
return ar;
}
Call me crazy, but probably use GZipOutputStream
etc directly (or the System.Compression counterparts)... saves a lot of implementation details...
Marc Gravell
2008-12-01 05:18:53