Read AtLeast(Span<Byte>, Int32, Boolean) Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Reads at least a minimum number of bytes from the current stream and advances the position within the stream by the number of bytes read.
public int ReadAtLeast (Span<byte> buffer, int minimumBytes, bool throwOnEndOfStream = true);
member this.ReadAtLeast : Span<byte> * int * bool -> int
Public Function ReadAtLeast (buffer As Span(Of Byte), minimumBytes As Integer, Optional throwOnEndOfStream As Boolean = true) As Integer
A region of memory. When this method returns, the contents of this region are replaced by the bytes read from the current stream.
The minimum number of bytes to read into the buffer.
true to throw an exception if the end of the stream is reached before reading
minimumBytes of bytes;
false to return less than
minimumBytes when the end of the stream is reached.
The default is
The total number of bytes read into the buffer. This is guaranteed to be greater than or equal to
true. This will be less than
minimumBytes when the end of the stream is reached and
false. This can be less than the number of bytes allocated in the buffer if that many bytes are not currently available.
minimumBytes is negative, or is greater than the length of
true and the end of the stream is reached before reading
minimumBytes bytes of data.
minimumBytes is 0 (zero), this read operation will be completed without waiting for available data in the stream.