Inheritance: PendingBuffer
 public DeflaterHuffman(DeflaterPending pending)
 {
     this.pending = pending;
     this.literalTree = new Tree(this, 0x11e, 0x101, 15);
     this.distTree = new Tree(this, 30, 1, 15);
     this.blTree = new Tree(this, 0x13, 4, 7);
     this.d_buf = new short[0x4000];
     this.l_buf = new byte[0x4000];
 }
 public DeflaterEngine(DeflaterPending pending)
 {
     this.pending = pending;
     this.huffman = new DeflaterHuffman(pending);
     this.adler = new Adler32();
     this.window = new byte[65536];
     this.head = new short[32768];
     this.prev = new short[32768];
     this.blockStart = (this.strstart = 1);
 }
		/// <summary>
		/// Construct instance with pending buffer
		/// </summary>
		/// <param name="pending">
		/// Pending buffer to use
		/// </param>>
		public DeflaterEngine(DeflaterPending pending) 
		{
			this.pending = pending;
			huffman = new DeflaterHuffman(pending);
			adler = new Adler32();
			
			window = new byte[2 * WSIZE];
			head   = new short[HASH_SIZE];
			prev   = new short[WSIZE];
			blockStart = strstart = 1;
		}
        /// <summary>
        /// Construct instance with pending buffer
        /// </summary>
        /// <param name="pending">
        /// Pending buffer to use
        /// </param>>
        public DeflaterEngine(DeflaterPending pending)
        {
            this.pending = pending;
            huffman      = new DeflaterHuffman(pending);
            adler        = new Adler32();

            window = new byte[2 * DeflaterConstants.WSIZE];
            head   = new short[DeflaterConstants.HASH_SIZE];
            prev   = new short[DeflaterConstants.WSIZE];

            // We start at index 1, to avoid an implementation deficiency, that
            // we cannot build a repeat pattern at index 0.
            blockStart = strstart = 1;
        }
        public Deflater(int level, bool noZlibHeaderOrFooter)
        {
            if (level == DEFAULT_COMPRESSION) {
                level = 6;
            } else if (level < NO_COMPRESSION || level > BEST_COMPRESSION) {
                throw new ArgumentOutOfRangeException("level");
            }

            pending = new DeflaterPending();
            engine = new DeflaterEngine(pending);
            this.noZlibHeaderOrFooter = noZlibHeaderOrFooter;
            SetStrategy(DeflateStrategy.Default);
            SetLevel(level);
            Reset();
        }
Exemple #6
0
 public Deflater(int level, bool noZlibHeaderOrFooter)
 {
     if (level == -1)
     {
         level = 6;
     }
     else if ((level < 0) || (level > 9))
     {
         throw new ArgumentOutOfRangeException("level");
     }
     this.pending = new DeflaterPending();
     this.engine  = new DeflaterEngine(this.pending);
     this.noZlibHeaderOrFooter = noZlibHeaderOrFooter;
     this.SetStrategy(DeflateStrategy.Default);
     this.SetLevel(level);
     this.Reset();
 }
Exemple #7
0
 public Deflater(int level, bool noZlibHeaderOrFooter)
 {
     if (level == -1)
     {
         level = 6;
     }
     else if ((level < 0) || (level > 9))
     {
         throw new ArgumentOutOfRangeException("level");
     }
     this.pending = new DeflaterPending();
     this.engine = new DeflaterEngine(this.pending);
     this.noZlibHeaderOrFooter = noZlibHeaderOrFooter;
     this.SetStrategy(DeflateStrategy.Default);
     this.SetLevel(level);
     this.Reset();
 }
Exemple #8
0
        /// <summary>
        /// Creates a new deflater with given compression level.
        /// </summary>
        /// <param name="level">
        /// the compression level, a value between NO_COMPRESSION
        /// and BEST_COMPRESSION.
        /// </param>
        /// <param name="noZlibHeaderOrFooter">
        /// true, if we should suppress the Zlib/RFC1950 header at the
        /// beginning and the adler checksum at the end of the output.  This is
        /// useful for the GZIP/PKZIP formats.
        /// </param>
        /// <exception cref="System.ArgumentOutOfRangeException">if lvl is out of range.</exception>
        public Deflater(int level, bool noZlibHeaderOrFooter)
        {
            if (level == DEFAULT_COMPRESSION)
            {
                level = 6;
            }
            else if (level < NO_COMPRESSION || level > BEST_COMPRESSION)
            {
                throw new ArgumentOutOfRangeException("level");
            }

            pending = new DeflaterPending();
            engine  = new DeflaterEngine(pending);
            this.noZlibHeaderOrFooter = noZlibHeaderOrFooter;
            SetStrategy(DeflateStrategy.Default);
            SetLevel(level);
            Reset();
        }
Exemple #9
0
        /// <summary>
        /// Creates a new deflater with given compression level.
        /// </summary>
        /// <param name="lvl">
        /// the compression level, a value between NO_COMPRESSION
        /// and BEST_COMPRESSION.
        /// </param>
        /// <param name="nowrap">
        /// true, if we should suppress the deflate header at the
        /// beginning and the adler checksum at the end of the output.  This is
        /// useful for the GZIP format.
        /// </param>
        /// <exception cref="System.ArgumentOutOfRangeException">if lvl is out of range.</exception>
        public Deflater(int lvl, bool nowrap)
        {
            if (lvl == DEFAULT_COMPRESSION)
            {
                lvl = 6;
            }
            else if (lvl < NO_COMPRESSION || lvl > BEST_COMPRESSION)
            {
                throw new ArgumentOutOfRangeException("lvl");
            }

            pending       = new DeflaterPending();
            engine        = new DeflaterEngine(pending);
            this.noHeader = nowrap;
            SetStrategy(DeflateStrategy.Default);
            SetLevel(lvl);
            Reset();
        }
Exemple #10
0
        /// <summary>
        /// Creates a new deflater with given compression level.
        /// </summary>
        /// <param name="level">
        /// the compression level, a value between NO_COMPRESSION
        /// and BEST_COMPRESSION.
        /// </param>
        /// <param name="noZlibHeaderOrFooter">
        /// true, if we should suppress the Zlib/RFC1950 header at the
        /// beginning and the adler checksum at the end of the output.  This is
        /// useful for the GZIP/PKZIP formats.
        /// </param>
        /// <exception cref="System.ArgumentOutOfRangeException">if lvl is out of range.</exception>
        public Deflater(int level, bool noZlibHeaderOrFooter)
        {
            if (level == DEFAULT_COMPRESSION)
            {
                level = 6;
            }
            else if (level < NO_COMPRESSION || level > BEST_COMPRESSION)
            {
                //throw new //nameofnameof//(level));
            }

            pending = new DeflaterPending();
            engine  = new DeflaterEngine(pending);
            this.noZlibHeaderOrFooter = noZlibHeaderOrFooter;
            SetStrategy(DeflateStrategy.Default);
            SetLevel(level);
            Reset();
        }
Exemple #11
0
 /// <summary>
 /// Construct instance with pending buffer
 /// </summary>
 /// <param name="pending">Pending buffer to use</param>
 public DeflaterHuffman(DeflaterPending pending)
 {
     this.pending = pending;
     
     literalTree = new Tree(this, LITERAL_NUM, 257, 15);
     distTree    = new Tree(this, DIST_NUM, 1, 15);
     blTree      = new Tree(this, BITLEN_NUM, 4, 7);
     
     d_buf = new short[BUFSIZE];
     l_buf = new byte [BUFSIZE];
 }
		/// <summary>
		/// Construct instance with pending buffer
		/// </summary>
		/// <param name="pending">
		/// Pending buffer to use
		/// </param>>
		public DeflaterEngine(DeflaterPending pending) 
		{
			this.pending = pending;
			huffman = new DeflaterHuffman(pending);
			adler = new Adler32();
			
			window = new byte[2 * WSIZE];
			head   = new short[HASH_SIZE];
			prev   = new short[WSIZE];
			
			// We start at index 1, to avoid an implementation deficiency, that
			// we cannot build a repeat pattern at index 0.
			blockStart = strstart = 1;
		}
Exemple #13
0
 /// <summary>
 /// Construct instance with pending buffer
 /// Adler calculation will be performed
 /// </summary>
 /// <param name="pending">
 /// Pending buffer to use
 /// </param>
 public DeflaterEngine(DeflaterPending pending)
     : this(pending, false)
 {
 }
Exemple #14
0
		/// <summary>
		/// Creates a new deflater with given compression level.
		/// </summary>
		/// <param name="lvl">
		/// the compression level, a value between NO_COMPRESSION
		/// and BEST_COMPRESSION.
		/// </param>
		/// <param name="nowrap">
		/// true, if we should suppress the deflate header at the
		/// beginning and the adler checksum at the end of the output.  This is
		/// useful for the GZIP format.
		/// </param>
		/// <exception cref="System.ArgumentOutOfRangeException">if lvl is out of range.</exception>
		public Deflater(int lvl, bool nowrap)
		{
			if (lvl == DEFAULT_COMPRESSION) {
				lvl = 6;
			} else if (lvl < NO_COMPRESSION || lvl > BEST_COMPRESSION) {
				throw new ArgumentOutOfRangeException("lvl");
			}
			
			pending = new DeflaterPending();
			engine = new DeflaterEngine(pending);
			this.noHeader = nowrap;
			SetStrategy(DeflateStrategy.Default);
			SetLevel(lvl);
			Reset();
		}