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

Method stringUtf8

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

Source from the content-addressed store, hash-verified

206 }
207
208 stringUtf8(len: number) {
209 if (len < 0 || len > this.byteLength - this.cursor) {
210 throw new Error("Insufficient bytes for UTF-8 string");
211 }
212 const end = this.cursor + len;
213 // JavaScript intentionally preserves platform UTF-8 replacement behavior; Rust is the runtime
214 // that provides checked UTF-8 string reads by default.
215 const result = this.platformBuffer.toString("utf8", this.cursor, end);
216 this.cursor += len;
217 return result;
218 }
219
220 stringUtf16LE(len: number) {
221 if (len < 0 || len > this.byteLength - this.cursor) {

Callers 2

stringWithHeaderMethod · 0.95
decodeMethod · 0.45

Calls 1

toStringMethod · 0.65

Tested by

no test coverage detected