Ejemplo n.º 1
0
        public void GetBlock(DeflateInput input, OutputBuffer output, bool isFinal)
        {
            Debug.Assert(output != null);
            Debug.Assert(output.FreeBytes >= 5);
            int num = 0;

            if (input != null)
            {
                num = Math.Min(input.Count, output.FreeBytes - 5 - output.BitsInBuffer);
                if (num > 65531)
                {
                    num = 65531;
                }
            }
            if (isFinal)
            {
                output.WriteBits(3, 1U);
            }
            else
            {
                output.WriteBits(3, 0U);
            }
            output.FlushBits();
            this.WriteLenNLen((ushort)num, output);
            if (input == null || num <= 0)
            {
                return;
            }
            output.WriteBytes(input.Buffer, input.StartIndex, num);
            input.ConsumeBytes(num);
        }
Ejemplo n.º 2
0
 internal static void WriteDeflatePreamble(OutputBuffer output)
 {
     output.WriteBytes(FastEncoderStatics.FastEncoderTreeStructureData, 0, FastEncoderStatics.FastEncoderTreeStructureData.Length);
     output.WriteBits(9, 34U);
 }