new void FillBuffer(int numBytes) { int offset = 0; do { int num = BaseStream.Read(buffer, offset, numBytes - offset); if (num == 0) throw new EndOfStreamException(); offset += num; } while (offset < numBytes); }