* Fill the window
()
| 469 | * Fill the window |
| 470 | */ |
| 471 | public fillWindow() { |
| 472 | /* If the window is almost full and there is insufficient lookahead, |
| 473 | * move the upper half to the lower one to make room in the upper half. |
| 474 | */ |
| 475 | if (this._strstart >= DeflaterConstants.wsize + DeflaterConstants.maxDist) { |
| 476 | this._slideWindow(); |
| 477 | } |
| 478 | |
| 479 | /* If there is not enough lookahead, but still some input left, |
| 480 | * read in the input |
| 481 | */ |
| 482 | if (this._lookahead < DeflaterConstants.minLookahead && this._inputOff < this._inputEnd) { |
| 483 | let more = 2 * DeflaterConstants.wsize - this._lookahead - this._strstart; |
| 484 | |
| 485 | if (more > this._inputEnd - this._inputOff) { |
| 486 | more = this._inputEnd - this._inputOff; |
| 487 | } |
| 488 | |
| 489 | this._window.set( |
| 490 | this._inputBuf!.subarray(this._inputOff, this._inputOff + more), |
| 491 | this._strstart + this._lookahead |
| 492 | ); |
| 493 | this.inputCrc.update(this._inputBuf!, this._inputOff, more); |
| 494 | |
| 495 | this._inputOff += more; |
| 496 | // this.totalIn += more; |
| 497 | this._lookahead += more; |
| 498 | } |
| 499 | |
| 500 | if (this._lookahead >= DeflaterConstants.minMatch) { |
| 501 | this._updateHash(); |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | private _slideWindow() { |
| 506 | this._window.set( |
no test coverage detected