Org.BouncyCastle.Utilities.Zlib.ZStream.read_buf C# (CSharp) Méthode

read_buf() private méthode

private read_buf ( byte buf, int start, int size ) : int
buf byte
start int
size int
Résultat int
        internal int read_buf(byte[] buf, int start, int size) {
            int len=avail_in;

            if(len>size) len=size;
            if(len==0) return 0;

            avail_in-=len;

            if(dstate.noheader==0) {
                adler=_adler.adler32(adler, next_in, next_in_index, len);
            }
            System.Array.Copy(next_in, next_in_index, buf, start, len);
            next_in_index  += len;
            total_in += len;
            return len;
        }

Usage Example

Exemple #1
0
 internal void fill_window()
 {
     do
     {
         int num = window_size - lookahead - strstart;
         int num2;
         if (num == 0 && strstart == 0 && lookahead == 0)
         {
             num = w_size;
         }
         else if (num == -1)
         {
             num--;
         }
         else if (strstart >= w_size + w_size - 262)
         {
             Array.Copy(window, w_size, window, 0, w_size);
             match_start -= w_size;
             strstart    -= w_size;
             block_start -= w_size;
             num2         = hash_size;
             int num3 = num2;
             do
             {
                 int num4 = head[--num3] & 0xFFFF;
                 head[num3] = (short)((num4 >= w_size) ? (num4 - w_size) : 0);
             }while (--num2 != 0);
             num2 = w_size;
             num3 = num2;
             do
             {
                 int num4 = prev[--num3] & 0xFFFF;
                 prev[num3] = (short)((num4 >= w_size) ? (num4 - w_size) : 0);
             }while (--num2 != 0);
             num += w_size;
         }
         if (strm.avail_in == 0)
         {
             break;
         }
         num2       = strm.read_buf(window, strstart + lookahead, num);
         lookahead += num2;
         if (lookahead >= 3)
         {
             ins_h = (window[strstart] & 0xFF);
             ins_h = (((ins_h << hash_shift) ^ (window[strstart + 1] & 0xFF)) & hash_mask);
         }
     }while (lookahead < 262 && strm.avail_in != 0);
 }