mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-22 19:10:41 -10:00
* Add Stream ReadAtLeast and ReadExactly Adds methods to Stream to read at least a minimum amount of bytes, or a full buffer, of data from the stream. ReadAtLeast allows for the caller to specify whether an exception should be thrown or not on the end of the stream. Make use of the new methods where appropriate in net7.0. Fix #16598 * Add ReadAtLeast and ReadExactly unit tests * Add XML docs to the new APIs * Preserve behavior in StreamReader.FillBuffer when passed 0. * Handle ReadExactly with an empty buffer, and ReadAtLeast with minimumBytes == 0. Both of these cases are a no-op. No exception is thrown. A read won't be issued to the underlying stream. They won't block until data is available.