step method
Implementation
bool step() {
if (!_data.deferred) {
return _copy();
}
if (_data.compression == CompressionType.none) {
return _store();
}
if (_data.compression != CompressionType.deflate) {
return _encode();
}
final sink = _sink;
if (sink == null || _closed || _source.isEOS) {
return false;
}
var left = _piece;
while (left > 0 && !_source.isEOS) {
final take = _source.length < 1024 ? _source.length : 1024;
// This body runs under `while (step())`. A break returns true and that
// loop spins forever. Returning false ends the body
// A caller's own InputStream may report a length that its isEOS does not
// agree with. Without this the loop takes nothing and never ends
if (take <= 0) {
return false;
}
final bytes = _source.readBytes(take).toUint8List();
_data.crc32 = getCrc32(bytes, _data.crc32);
_read += bytes.length;
sink.add(bytes);
left -= take;
}
return true;
}