Cyro
Cyro

Reputation: 91

What does the Flush method do on a DeflateStream?

What does the Flush method do on a DeflateStream?

The description for the DeflateStream.Flush method is:

Flushes the contents of the internal buffer of the current stream object to the underlying stream.

Is this an accurate description? And if so, what does it mean?

To elaborate on the points of confusion: The DeflateStream constructor requires a Stream argument described as "The stream to compress or decompress". Is that "the underlying stream"? If so, why would you flush a buffer to the stream you're compressing or decompressing? If not, then what is "the underlying stream"?

Upvotes: 0

Views: 261

Answers (1)

Matthew Haugen
Matthew Haugen

Reputation: 13296

If you look at the documentation,

The current implementation of this method has no functionality.

Remarks

The current implementation of this method does not flush the internal buffer. The internal buffer is flushed when the object is disposed.

It's there because it has to be there. It comes from the polymorphic parent Stream, where, as I suspect you already know, it's useful for most other kinds of streams, like NetworkStream and FileStream.

Upvotes: 1

Related Questions