Deflate.stream constructor

Deflate.stream(
  1. InputStream _input, {
  2. int level = DeflateLevel.defaultCompression,
  3. int windowBits = maxWindowBits,
  4. OutputStream? output,
})

Deflate the given InputStream _input. _input can be null, which means it won't start compressing any data in the constructor and you can use addStream to compress incoming data in chunks, followed by finish to finalize the compression. level is the compression level to use for the deflate algorithm. If not provided, the default level of 6 is used. If output is provided, the compressed data will be written to that OutputStream, otherwise the compressed data will be accessed from the getBytes method.

Implementation

Deflate.stream(this._input,
    {int level = DeflateLevel.defaultCompression,
    int windowBits = maxWindowBits,
    OutputStream? output})
    : _output = output ?? OutputMemoryStream() {
  _init(level, windowBits: windowBits);
  _deflate(_DeflateFlushMode.finish);
}