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

Method deserialize

projects/JavaScript/proto/test.js:22427–22440  ·  view source on GitHub ↗

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

(value = new StructHash())

Source from the content-addressed store, hash-verified

22425 * @return {!object} Deserialized StructHash value and its size
22426 */
22427 deserialize (value = new StructHash()) {
22428 if ((this.buffer.offset + this.model.fbeOffset - 4) > this.buffer.size) {
22429 return { value: new StructHash(), size: 0 }
22430 }
22431
22432 let fbeFullSize = this.readUInt32(this.model.fbeOffset - 4)
22433 console.assert((fbeFullSize >= this.model.fbeSize), 'Model is broken!')
22434 if (fbeFullSize < this.model.fbeSize) {
22435 return { value: new StructHash(), size: 0 }
22436 }
22437
22438 this.model.get(value)
22439 return { value: value, size: fbeFullSize }
22440 }
22441
22442 /**
22443 * 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