CryptoStream.ReadByte 方法

定义

从流中读取一个字节,并将流内的位置向前提升一个字节,或者如果已到达流结尾,则返回 -1。Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.

public:
 override int ReadByte();
public override int ReadByte ();
override this.ReadByte : unit -> int
Public Overrides Function ReadByte () As Integer

返回

强制转换为 Int32 的无符号字节,如果到达流的末尾,则为 -1。The unsigned byte cast to an Int32, or -1 if at the end of the stream.

异常

流不支持读取。The stream does not support reading.

在流关闭后调用方法。Methods were called after the stream was closed.

注解

使用 CanRead 属性可确定当前实例是否支持读取。Use the CanRead property to determine whether the current instance supports reading.

在流关闭之后尝试操作流可能会引发 ObjectDisposedExceptionAttempts to manipulate the stream after the stream has been closed could throw an ObjectDisposedException.

适用于