(string: string)
| 42 | } |
| 43 | |
| 44 | public addCString(string: string): Writer { |
| 45 | if (string) { |
| 46 | // TODO(msfstef): might be faster to extract `addString` code and |
| 47 | // ensure length + 1 once rather than length and then +1? |
| 48 | this.addString(string) |
| 49 | } |
| 50 | |
| 51 | // set null terminator |
| 52 | this.#ensure(1) |
| 53 | this.#bufferView.setUint8(this.#offset, 0) |
| 54 | this.#offset++ |
| 55 | return this |
| 56 | } |
| 57 | |
| 58 | public addString(string: string = ''): Writer { |
| 59 | const length = byteLengthUtf8(string) |
no test coverage detected