Esempio n. 1
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 block size and
 /// and work factor.
 /// </remarks>
 /// <param name="conf">Configuration storing new settings</param>
 public virtual void Reinit(Configuration conf)
 {
     lock (this)
     {
         Reset();
         End(stream);
         if (conf == null)
         {
             stream = Init(blockSize, workFactor);
             return;
         }
         blockSize  = Bzip2Factory.GetBlockSize(conf);
         workFactor = Bzip2Factory.GetWorkFactor(conf);
         stream     = Init(blockSize, workFactor);
         if (Log.IsDebugEnabled())
         {
             Log.Debug("Reinit compressor with new compression configuration");
         }
     }
 }
Esempio n. 2
0
 /// <summary>Creates a new compressor, taking settings from the configuration.</summary>
 public Bzip2Compressor(Configuration conf)
     : this(Bzip2Factory.GetBlockSize(conf), Bzip2Factory.GetWorkFactor(conf), DefaultDirectBufferSize
            )
 {
 }