MCPcopy Create free account
hub / github.com/apache/fory / stringUtf16LE

Method stringUtf16LE

javascript/packages/core/lib/reader/index.ts:220–234  ·  view source on GitHub ↗
(len: number)

Source from the content-addressed store, hash-verified

218 }
219
220 stringUtf16LE(len: number) {
221 if (len < 0 || len > this.byteLength - this.cursor) {
222 throw new Error("Insufficient bytes for UTF-16LE string");
223 }
224 if ((len & 1) !== 0) {
225 throw new Error("UTF-16LE string length must be even");
226 }
227 const result = this.platformBuffer.toString(
228 "utf16le",
229 this.cursor,
230 this.cursor + len,
231 );
232 this.cursor += len;
233 return result;
234 }
235
236 stringWithHeader() {
237 const header = this.readVarUint36Small();

Callers 1

stringWithHeaderMethod · 0.95

Calls 1

toStringMethod · 0.65

Tested by

no test coverage detected