Stream.ReadExactly 方法

定义

重载

ReadExactly(Span<Byte>)

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

ReadExactly(Byte[], Int32, Int32)

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

ReadExactly(Span<Byte>)

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

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 和 (offset + count - 1) 替换为从当前流读取的字节。

offset
Int32

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

count
Int32

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

例外

buffernull

offsetbuffer 的界限外。

- 或 -

count 为负数。

- 或 -

count 的组合offset指定的范围超出了 的buffer长度。

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

注解

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

适用于