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 a implementation deficiency, that
             * we cannot build a repeat pattern at index 0.
             */
            blockStart = strstart = 1;
        }
예제 #2
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(DEFAULT_STRATEGY);
            SetLevel(lvl);
            Reset();
        }
예제 #3
0
파일: zipmark.cs 프로젝트: Zman0169/mono
		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 a implementation deficiency, that
			* we cannot build a repeat pattern at index 0.
			*/
			blockStart = strstart = 1;
		}
예제 #4
0
파일: zipmark.cs 프로젝트: Zman0169/mono
		/// <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(DEFAULT_STRATEGY);
			SetLevel(lvl);
			Reset();
		}
예제 #5
0
파일: zipmark.cs 프로젝트: Zman0169/mono
		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];
		}