Flush 方法在 DeflateStream 上做了什么?

What does the Flush method do on a DeflateStream?

Flush 方法在 DeflateStream 上做了什么?

DeflateStream.Flush 方法的描述是:

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

这个描述准确吗?如果是,那是什么意思?

详细说明混淆点:DeflateStream 构造函数需要一个描述为 "The stream to compress or decompress" 的 Stream 参数。那是"the underlying stream"吗?如果是这样,为什么要将缓冲区刷新到正在压缩或解压缩的流中?如果不是,那么 "the underlying stream" 是什么?

如果您查看 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.

它在那里是因为它必须在那里。它来自多态父 Stream,我怀疑您已经知道,它对 大多数 其他类型的流很有用,例如 NetworkStreamFileStream.