Stream.ReadExactly 方法

定义

重载

名称 说明
ReadExactly(Span<Byte>)

从当前流中读取字节,并在填充之前 buffer 推进流中的位置。

ReadExactly(Byte[], Int32, Int32)

count从当前流中读取字节数,并推进流中的位置。

ReadExactly(Span<Byte>)

Source:
Stream.cs
Source:
Stream.cs
Source:
Stream.cs
Source:
Stream.cs
Source:
Stream.cs

从当前流中读取字节,并在填充之前 buffer 推进流中的位置。

public:
 void ReadExactly(Span<System::Byte> buffer);
public void ReadExactly(Span<byte> buffer);
member this.ReadExactly : Span<byte> -> unit
Public Sub ReadExactly (buffer As Span(Of Byte))

参数

buffer
Span<Byte>

内存区域。 此方法返回时,此区域的内容将替换为从当前流中读取的字节。

例外

在填充 buffer流之前到达流的末尾。

注解

如果 buffer 为空,将完成此读取操作,而无需等待流中的可用数据。

适用于

ReadExactly(Byte[], Int32, Int32)

Source:
Stream.cs
Source:
Stream.cs
Source:
Stream.cs
Source:
Stream.cs
Source:
Stream.cs

count从当前流中读取字节数,并推进流中的位置。

public:
 void ReadExactly(cli::array <System::Byte> ^ buffer, int offset, int count);
public void ReadExactly(byte[] buffer, int offset, int count);
member this.ReadExactly : byte[] * int * int -> unit
Public Sub ReadExactly (buffer As Byte(), offset As Integer, count As Integer)

参数

buffer
Byte[]

字节数组。 此方法返回时,缓冲区包含指定的字节数组,其值介于和 (offset + count- 1) 之间offset,由从当前流中读取的字节替换。

offset
Int32

从中开始存储从当前流中读取的数据的字节偏移量 buffer

count
Int32

要从当前流中读取的字节数。

例外

buffernull

offset 位于 . 的 buffer边界之外。

-或-

count 为负数。

-或-

由组合 offset 指定的范围超过 count 长度 buffer

在读取 count 字节数之前,将到达流的末尾。

注解

如果 count 为 0(零),则此读取操作将完成,而无需等待流中的可用数据。

适用于