MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / deserialize

Method deserialize

projects/JavaScript/proto/test.js:20682–20695  ·  view source on GitHub ↗

* Deserialize the struct value * @this {!StructMapModel} * @param {!StructMap} value StructMap value, defaults is new StructMap() * @return {!object} Deserialized StructMap value and its size

(value = new StructMap())

Source from the content-addressed store, hash-verified

20680 * @return {!object} Deserialized StructMap value and its size
20681 */
20682 deserialize (value = new StructMap()) {
20683 if ((this.buffer.offset + this.model.fbeOffset - 4) > this.buffer.size) {
20684 return { value: new StructMap(), size: 0 }
20685 }
20686
20687 let fbeFullSize = this.readUInt32(this.model.fbeOffset - 4)
20688 console.assert((fbeFullSize >= this.model.fbeSize), 'Model is broken!')
20689 if (fbeFullSize < this.model.fbeSize) {
20690 return { value: new StructMap(), size: 0 }
20691 }
20692
20693 this.model.get(value)
20694 return { value: value, size: fbeFullSize }
20695 }
20696
20697 /**
20698 * Move to the next struct value

Callers 1

cloneMethod · 0.95

Calls 2

readUInt32Method · 0.45
getMethod · 0.45

Tested by

no test coverage detected