System\IO\Ports\SerialPort.cs (18)
202return _internalSerialStream.BytesToRead + CachedBytesToRead; // count the number of bytes we have in the internal buffer too.
673if (CachedBytesToRead >= 1)
675bytesReadToBuffer = Math.Min(CachedBytesToRead, count);
689Debug.Assert(CachedBytesToRead == 0, "there should be nothing left in our internal buffer");
724if (_decoder.GetCharCount(_inBuffer, _readPos, CachedBytesToRead) != 0)
833int charsWeAlreadyHave = _decoder.GetCharCount(_inBuffer, _readPos, CachedBytesToRead); // full chars already in our buffer
891int bytesToRead = Math.Min(count, CachedBytesToRead);
970} while ((totalCharsFound < count) && (totalBytesExamined < CachedBytesToRead));
1000Buffer.BlockCopy(_inBuffer, _readPos, bytesReceived, 0, CachedBytesToRead);
1004_internalSerialStream.ReadExactly(bytesReceived, CachedBytesToRead, bytesReceived.Length - CachedBytesToRead); // get everything
1148int bytesToSave = CachedBytesToRead;
1306Buffer.BlockCopy(_inBuffer, _readPos, _inBuffer, 0, CachedBytesToRead);
1307_readLen = CachedBytesToRead;
1325if (CachedBytesToRead + additionalByteLength <= _inBuffer.Length / 2)
1330int newLength = Math.Max(CachedBytesToRead + additionalByteLength, _inBuffer.Length * 2);
1335Buffer.BlockCopy(_inBuffer, _readPos, newBuffer, 0, CachedBytesToRead);
1336_readLen = CachedBytesToRead;