internal DeflateStream(Stream compressedStream, CompressionMode mode, bool leaveOpen, bool gzip) { if (compressedStream == null) { throw new ArgumentNullException("compressedStream"); } if (mode != CompressionMode.Compress && mode != CompressionMode.Decompress) { throw new ArgumentException("mode"); } this.data = GCHandle.Alloc(this); this.base_stream = compressedStream; this.feeder = (mode == CompressionMode.Compress) ? new UnmanagedReadOrWrite(UnmanagedWrite) : new UnmanagedReadOrWrite(UnmanagedRead); this.z_stream = CreateZStream(mode, gzip, feeder, GCHandle.ToIntPtr(data)); if (z_stream == IntPtr.Zero) { this.base_stream = null; this.feeder = null; throw new NotImplementedException("Failed to initialize zlib. You probably have an old zlib installed. Version 1.2.0.4 or later is required."); } this.mode = mode; this.leaveOpen = leaveOpen; }
internal DeflateStream (Stream compressedStream, CompressionMode mode, bool leaveOpen, bool gzip) { if (compressedStream == null) throw new ArgumentNullException ("compressedStream"); if (mode != CompressionMode.Compress && mode != CompressionMode.Decompress) throw new ArgumentException ("mode"); this.data = GCHandle.Alloc (this); this.base_stream = compressedStream; this.feeder = (mode == CompressionMode.Compress) ? new UnmanagedReadOrWrite (UnmanagedWrite) : new UnmanagedReadOrWrite (UnmanagedRead); this.z_stream = CreateZStream (mode, gzip, feeder, GCHandle.ToIntPtr (data)); if (z_stream == IntPtr.Zero) { this.base_stream = null; this.feeder = null; throw new NotImplementedException ("Failed to initialize zlib. You probably have an old zlib installed. Version 1.2.0.4 or later is required."); } this.mode = mode; this.leaveOpen = leaveOpen; }
static IntPtr CreateZStream (CompressionMode compress, bool gzip, UnmanagedReadOrWrite feeder, IntPtr data) { throw new System.NotImplementedException(); }
static extern IntPtr CreateZStream (CompressionMode compress, bool gzip, UnmanagedReadOrWrite feeder, IntPtr data);
static extern IntPtr CreateZStream(CompressionMode compress, bool gzip, UnmanagedReadOrWrite feeder, IntPtr data);
static IntPtr CreateZStream(CompressionMode compress, bool gzip, UnmanagedReadOrWrite feeder, IntPtr data) { throw new System.NotImplementedException(); }