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

Method deserialize

projects/JavaScript/proto/test.js:19161–19174  ·  view source on GitHub ↗

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

(value = new StructSet())

Source from the content-addressed store, hash-verified

19159 * @return {!object} Deserialized StructSet value and its size
19160 */
19161 deserialize (value = new StructSet()) {
19162 if ((this.buffer.offset + this.model.fbeOffset - 4) > this.buffer.size) {
19163 return { value: new StructSet(), size: 0 }
19164 }
19165
19166 let fbeFullSize = this.readUInt32(this.model.fbeOffset - 4)
19167 console.assert((fbeFullSize >= this.model.fbeSize), 'Model is broken!')
19168 if (fbeFullSize < this.model.fbeSize) {
19169 return { value: new StructSet(), size: 0 }
19170 }
19171
19172 this.model.get(value)
19173 return { value: value, size: fbeFullSize }
19174 }
19175
19176 /**
19177 * 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