(capacity: number)
| 31 | private off = 0; |
| 32 | |
| 33 | constructor(capacity: number) { |
| 34 | if (!Number.isInteger(capacity) || capacity < 0) { |
| 35 | throw new ZrBinaryError({ |
| 36 | code: "ZR_LIMIT", |
| 37 | offset: 0, |
| 38 | detail: `capacity must be a non-negative integer (got ${String(capacity)})`, |
| 39 | }); |
| 40 | } |
| 41 | if (capacity > MAX_WRITER_CAPACITY_BYTES) { |
| 42 | throw new ZrBinaryError({ |
| 43 | code: "ZR_LIMIT", |
| 44 | offset: 0, |
| 45 | detail: `capacity ${String(capacity)} exceeds maximum ${String(MAX_WRITER_CAPACITY_BYTES)}`, |
| 46 | }); |
| 47 | } |
| 48 | this.buf = new Uint8Array(capacity); |
| 49 | this.dv = new DataView(this.buf.buffer, this.buf.byteOffset, this.buf.byteLength); |
| 50 | } |
| 51 | |
| 52 | get offset(): number { |
| 53 | return this.off; |
nothing calls this directly
no outgoing calls
no test coverage detected