This documentation is archived and is not being maintained.

CryptoStream.Flush Method

Clears all buffers for this stream and causes any buffered data to be written to the underlying device.

[Visual Basic]
Overrides Public Sub Flush()
[C#]
public override void Flush();
[C++]
public: void Flush();
[JScript]
public override function Flush();

Exceptions

Exception Type Condition
NotSupportedException The current stream is not writable.

Remarks

Flushing the stream will not flush its underlying encoder unless you explicitly call Flush or Close. 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. This scenario affects UTF8 and UTF7 where certain characters can only be encoded after the encoder receives the adjacent character or characters.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

CryptoStream Class | CryptoStream Members | System.Security.Cryptography Namespace | Cryptographic Services

Show: