// Read a new buffer from the current input stream, update the adler32
// and total number of bytes read. All deflate() input goes through
// this function so some applications may wish to modify it to avoid
// allocating a large strm->next_in buffer and copying from it.
// (See also flush_pending()).
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);
}