(parts)
| 170 | state.position += bytes.byteLength; |
| 171 | } |
| 172 | writeName(parts) { |
| 173 | const state = this.state; |
| 174 | for (let i = 0; i < parts.length; i++) { |
| 175 | const suffix = parts.slice(i).join("."); |
| 176 | const target = state.nameOffsets.get(suffix); |
| 177 | if (undefined !== target) { |
| 178 | this.writeU16(0xC000 | target); |
| 179 | return; |
| 180 | } |
| 181 | |
| 182 | if (state.position < 0x4000) |
| 183 | state.nameOffsets.set(suffix, state.position); |
| 184 | |
| 185 | const label = ArrayBuffer.fromString(parts[i]); |
| 186 | this.writeU8(label.byteLength); |
| 187 | this.writeBytes(new Uint8Array(label)); |
| 188 | } |
| 189 | |
| 190 | this.writeU8(0); |
| 191 | } |
| 192 | writeRData(type, data) { |
| 193 | if (!data) |
| 194 | return; |
no test coverage detected