System\IO\Ports\SerialPort.cs (18)
203return _internalSerialStream.BytesToRead + CachedBytesToRead; // count the number of bytes we have in the internal buffer too.
675if (CachedBytesToRead >= 1)
677bytesReadToBuffer = Math.Min(CachedBytesToRead, count);
691Debug.Assert(CachedBytesToRead == 0, "there should be nothing left in our internal buffer");
726if (_decoder.GetCharCount(_inBuffer, _readPos, CachedBytesToRead) != 0)
835int charsWeAlreadyHave = _decoder.GetCharCount(_inBuffer, _readPos, CachedBytesToRead); // full chars already in our buffer
893int bytesToRead = Math.Min(count, CachedBytesToRead);
972} while ((totalCharsFound < count) && (totalBytesExamined < CachedBytesToRead));
1002Buffer.BlockCopy(_inBuffer, _readPos, bytesReceived, 0, CachedBytesToRead);
1006_internalSerialStream.ReadExactly(bytesReceived, CachedBytesToRead, bytesReceived.Length - CachedBytesToRead); // get everything
1150int 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;