public int Read(byte[] buffer, int offset, int count) { int result = reader.Read(buffer, offset, count); if (result > 0) { if (bufferLength + result > bufferPool.BufferSize) { Flush(); } Buffer.BlockCopy(buffer, offset, this.buffer, bufferLength, result); bufferLength += result; ReadBytes += result; Flush(); } return(result); }
public override int Read(byte[] buffer, int offset, int count) { if (bytesRemaining == -1) { return(0); } if (bytesRemaining == 0) { if (isChunked) { getNextChunk(); } else { bytesRemaining = -1; } } if (bytesRemaining == -1) { return(0); } int toRead = (int)Math.Min(count, bytesRemaining); int res = baseStream.Read(buffer, offset, toRead); bytesRemaining -= res; if (res == 0) { bytesRemaining = -1; } return(res); }
int ICustomStreamReader.Read(byte[] buffer, int offset, int count) { return(baseStream.Read(buffer, offset, count)); }