PrintQueueStream.Read(Byte[], Int32, Int32) 方法

定义

从流中读取字节序列,并按所读取的字节数向前移动在流中的读/写位置。Reads a sequence of bytes from the stream and advances the read/write position in the stream by the number of bytes that were read.

public:
 override int Read(cli::array <System::Byte> ^ buffer, int offset, int count);
public override int Read (byte[] buffer, int offset, int count);
[System.Security.SecurityCritical]
public override int Read (byte[] buffer, int offset, int count);
override this.Read : byte[] * int * int -> int
Public Overrides Function Read (buffer As Byte(), offset As Integer, count As Integer) As Integer

参数

buffer
Byte[]

字节数组。An array of bytes.

offset
Int32

缓冲区(想在此开始存储从流中读取的数据)中从零开始的字节偏移量。The zero-based byte offset in the buffer where you want to begin storing the data that is read from the stream.

count
Int32

要从流中读取的最大字节数。The maximum number of bytes to be read from the stream.

返回

一个 Int32,拥有读入缓冲区的字节总数。An Int32 that holds the total number of bytes that are read into the buffer.

属性

注解

如果很多字节当前不可用,则返回值可能小于请求的字节数;如果读取/写入位置位于流的末尾,则此数字可以为零(0)。The return value can be less than the number of requested bytes if that many bytes are not currently available; or the number can be zero (0) if the read/write position is at the end of the stream.

此方法返回时,buffer 包含指定的字节数组,并且 offset 和(offset + count-1)之间的值将替换为从源中读取的字节。When this method returns, buffer contains the specified byte array and the values between offset and (offset + count - 1) are replaced by the bytes that are read from the source.

适用于