(str)
| 106 | } |
| 107 | |
| 108 | writeString(str) { |
| 109 | if (typeof str === "undefined") { |
| 110 | throw new Error("can not write undefined"); |
| 111 | } |
| 112 | const len = Buffer.byteLength(str, 'utf8'); |
| 113 | const buf = utils.allocBufferUnsafe(2 + len); |
| 114 | buf.writeUInt16BE(len, 0); |
| 115 | buf.write(str, 2, buf.length-2, 'utf8'); |
| 116 | this.add(buf); |
| 117 | } |
| 118 | |
| 119 | writeLString(str) { |
| 120 | const len = Buffer.byteLength(str, 'utf8'); |
no test coverage detected