public override int Read(byte[] buffer, int offset, int count)
{
this.CheckDisposed();
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (offset < 0)
{
throw new ArgumentOutOfRangeException("offset", "offset cannot be negative");
}
if (count < 0)
{
throw new ArgumentOutOfRangeException("count", "count cannot be negative");
}
if (offset + count > buffer.Length)
{
throw new ArgumentException("buffer length must be at least offset + count");
}
int amountRead = this.InternalRead(buffer, offset, count, this.position);
this.position += amountRead;
return amountRead;
}