CryptoStream.Flush 方法

定义

清理当前流的所有缓冲区,并使所有缓冲数据写入基础设备。Clears all buffers for the current stream and causes any buffered data to be written to the underlying device.

public:
 override void Flush();
public override void Flush ();
override this.Flush : unit -> unit
Public Overrides Sub Flush ()

注解

除非显式调用 FlushClose,否则刷新流将不会刷新其基础编码器。Flushing the stream will not flush its underlying encoder unless you explicitly call Flush or Close. AutoFlush 设置为 true 表示将数据从缓冲区刷新到流,但编码器状态不会被刷新。Setting AutoFlush to true means that data will be flushed from the buffer to the stream, but the encoder state will not be flushed. 这允许编码器保留其状态(部分字符),以使其能够正确编码下一个字符块。This allows the encoder to keep its state (partial characters) so that it can encode the next block of characters correctly. 此方案影响 UTF8 和 UTF7,其中某些字符只能在编码器接收到相邻字符后编码。This scenario affects UTF8 and UTF7 where certain characters can only be encoded after the encoder receives the adjacent character or characters.

备注

应调用 Close 方法或 FlushFinalBlock 方法来完成刷新缓冲区。You should call either the Close method or the FlushFinalBlock method to complete flushing the buffer.

适用于

另请参阅