Example #1
0
 public static void SetParams(Deflate/*!*/ self, [NotNull]MutableString/*!*/ dictionary)
 {
     byte[] buffer = dictionary.ToByteArray();
     var zst = self.GetStream();
     int err = zst.deflateSetDictionary(buffer, buffer.Length);
     if (err != Z_OK) {
         throw MakeError(err, zst.msg);
     }
 }
Example #2
0
            public static MutableString Compress(Deflate/*!*/ self, [DefaultProtocol]MutableString str, [DefaultParameterValue(NO_FLUSH)]int flush)
            {
                MutableString compressed;
                MutableString trailingUncompressedData = null;

                var zst = self.GetStream();
                int result = Process(zst, str, (zlib.FlushStrategy)flush, compress, out compressed, ref trailingUncompressedData);

                if (result != Z_OK) {
                    throw MakeError(result, zst.msg);
                }

                return compressed;
            }
Example #3
0
 public static void SetParams(
     Deflate/*!*/ self,
     [DefaultParameterValue(DEFAULT_COMPRESSION)]int level,
     [DefaultParameterValue(DEFAULT_STRATEGY)]int strategy)
 {
     var zst = self.GetStream();
     int err = zst.deflateParams(level, (zlib.CompressionStrategy)strategy);
     if (err != Z_OK) {
         throw MakeError(err, zst.msg);
     }
 }
Example #4
0
            public static Deflate AppendData(Deflate/*!*/ self, [DefaultProtocol]MutableString str)
            {
                var zst = self.GetStream();

                MutableString trailingUncompressedData = null;
                int result = Process(zst, str, zlib.FlushStrategy.Z_NO_FLUSH, compress, ref trailingUncompressedData);

                if (result != Z_OK) {
                    throw MakeError(result, zst.msg);
                }

                return self;
            }