ComponentAce.Compression.Libs.ZLib.ZStream.read_buf C# (CSharp) Method

read_buf() public method

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 next_in buffer and copying from it.
public read_buf ( byte buf, int start, int size ) : int
buf byte
start int
size int
return int
		public 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 = Adler32.GetAdler32Checksum(adler, _next_in, _next_in_index, len);
			}
			Array.Copy(_next_in, _next_in_index, buf, start, len);
			_next_in_index += len;
			_total_in += len;
			return len;
		}