Example #1
0
 /// <summary>Creates a new compressor using the specified compression level.</summary>
 /// <remarks>
 /// Creates a new compressor using the specified compression level.
 /// Compressed data will be generated in ZLIB format.
 /// </remarks>
 /// <param name="level">Compression level #CompressionLevel</param>
 /// <param name="strategy">Compression strategy #CompressionStrategy</param>
 /// <param name="header">Compression header #CompressionHeader</param>
 /// <param name="directBufferSize">Size of the direct buffer to be used.</param>
 public ZlibCompressor(ZlibCompressor.CompressionLevel level, ZlibCompressor.CompressionStrategy
                       strategy, ZlibCompressor.CompressionHeader header, int directBufferSize)
 {
     this.level      = level;
     this.strategy   = strategy;
     this.windowBits = header;
     stream          = Init(this.level.CompressionLevel(), this.strategy.CompressionStrategy(),
                            this.windowBits.WindowBits());
     this.directBufferSize = directBufferSize;
     uncompressedDirectBuf = ByteBuffer.AllocateDirect(directBufferSize);
     compressedDirectBuf   = ByteBuffer.AllocateDirect(directBufferSize);
     compressedDirectBuf.Position(directBufferSize);
 }
Example #2
0
 /// <summary>
 /// Prepare the compressor to be used in a new stream with settings defined in
 /// the given Configuration.
 /// </summary>
 /// <remarks>
 /// Prepare the compressor to be used in a new stream with settings defined in
 /// the given Configuration. It will reset the compressor's compression level
 /// and compression strategy.
 /// </remarks>
 /// <param name="conf">Configuration storing new settings</param>
 public virtual void Reinit(Configuration conf)
 {
     Reset();
     if (conf == null)
     {
         return;
     }
     End(stream);
     level    = ZlibFactory.GetCompressionLevel(conf);
     strategy = ZlibFactory.GetCompressionStrategy(conf);
     stream   = Init(level.CompressionLevel(), strategy.CompressionStrategy(), windowBits
                     .WindowBits());
     if (Log.IsDebugEnabled())
     {
         Log.Debug("Reinit compressor with new compression configuration");
     }
 }
Example #3
0
 public static void SetCompressionLevel(Configuration conf, ZlibCompressor.CompressionLevel
                                        level)
 {
     conf.SetEnum("zlib.compress.level", level);
 }
Example #4
0
 protected internal void Construct(ZlibCompressor.CompressionLevel level, ZlibCompressor.CompressionStrategy
                                   strategy, ZlibCompressor.CompressionHeader header, int directBufferSize)
 {
 }