BinaryWriter.Write7BitEncodedInt(Int32) 方法

定义

以压缩格式写入 32 位整数。Writes a 32-bit integer in a compressed format.

protected:
 void Write7BitEncodedInt(int value);
protected void Write7BitEncodedInt (int value);
member this.Write7BitEncodedInt : int -> unit
Protected Sub Write7BitEncodedInt (value As Integer)

参数

value
Int32

要写入的 32 位整数。The 32-bit integer to be written.

例外

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

流已关闭。The stream is closed.

流已关闭。The stream is closed.

注解

value 参数的整数,一次写出7位,从七个最低有效位开始。The integer of the value parameter is written out seven bits at a time, starting with the seven least-significant bits. 字节的高位指示在此后是否要写入更多的字节。The high bit of a byte indicates whether there are more bytes to be written after this one.

如果 value 将适合7位,则只需要一个字节的空间。If value will fit in seven bits, it takes only one byte of space. 如果 value 不能容纳7位,则将在第一个字节上设置高位并写出。然后,value 将移位7位,并写入下一个字节。If value will not fit in seven bits, the high bit is set on the first byte and written out. value is then shifted by seven bits and the next byte is written. 此过程将重复进行,直至写入整个整数。This process is repeated until the entire integer has been written.

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

适用于