()
| 563 | } |
| 564 | |
| 565 | finish(): Uint8Array { |
| 566 | const value = view(this.bytes.buffer, this.bytes.byteOffset + this.start, this.offset - this.start) |
| 567 | if (this.bytes.length > this.poolSize) { |
| 568 | // An oversized message grew the pool; do not keep the rest of it around. |
| 569 | this.bytes = new Uint8Array(this.poolSize) |
| 570 | this.view = new DataView(this.bytes.buffer) |
| 571 | this.start = 0 |
| 572 | this.offset = 0 |
| 573 | } else { |
| 574 | this.start = this.offset |
| 575 | } |
| 576 | return value |
| 577 | } |
| 578 | } |
| 579 | |
| 580 | const emptyBytes = new Uint8Array(0) |
no test coverage detected