NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

BufferedStream.Flush

Updates the underlying data source or repository with the current state of the buffer and subsequently clears the buffer.

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

Exceptions

Exception Type Condition
IOException The data source or repository is not open.

Remarks

A buffer can be used for either reading or writing, but never both simultaneously. That is, before the buffer can be used for reading, any data previously written to the buffer must be copied to the underlying data source or repository. (Data written to the buffer must also be copied to the underlying data source or repository before the buffer overfills as a result of successive writes.)

On the other hand, before the buffer can be used for writing, the position within the underlying stream must be decremented by the number of unread bytes previously copied from the underlying data source or repository to the buffer. Otherwise data that is subsequently written to the buffer would not be copied to the appropriate place within the underlying stream.

All the read and write methods of BufferedStream automatically maintain the buffer, so there is no need to invoke Flush when switching back and forth between reading and writing.

See Also

BufferedStream Class | BufferedStream Members | System.IO Namespace | Close