BinaryReader.ReadInt16 方法

定义

从当前流中读取 2 字节有符号整数,并使流的当前位置提升 2 个字节。Reads a 2-byte signed integer from the current stream and advances the current position of the stream by two bytes.

public:
 virtual short ReadInt16();
public virtual short ReadInt16 ();
abstract member ReadInt16 : unit -> int16
override this.ReadInt16 : unit -> int16
Public Overridable Function ReadInt16 () As Short

返回

Int16

从当前流中读取的 2 字节有符号整数。A 2-byte signed integer read from the current stream.

例外

已到达流的末尾。The end of the stream is reached.

流已关闭。The stream is closed.

出现 I/O 错误。An I/O error occurred.

注解

BinaryReader 读取失败后不还原文件位置。BinaryReader does not restore the file position after an unsuccessful read.

BinaryReader 以小字节序格式读取此数据类型。BinaryReader reads this data type in little-endian format.

有关常见 i/o 任务的列表,请参阅 常见 I/o 任务For a list of common I/O tasks, see Common I/O Tasks.

适用于