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

Method deserialize

projects/JavaScript/proto/protoex.js:2573–2586  ·  view source on GitHub ↗

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

(value = new Balance())

Source from the content-addressed store, hash-verified

2571 * @return {!object} Deserialized Balance value and its size
2572 */
2573 deserialize (value = new Balance()) {
2574 if ((this.buffer.offset + this.model.fbeOffset - 4) > this.buffer.size) {
2575 return { value: new Balance(), size: 0 }
2576 }
2577
2578 let fbeFullSize = this.readUInt32(this.model.fbeOffset - 4)
2579 console.assert((fbeFullSize >= this.model.fbeSize), 'Model is broken!')
2580 if (fbeFullSize < this.model.fbeSize) {
2581 return { value: new Balance(), size: 0 }
2582 }
2583
2584 this.model.get(value)
2585 return { value: value, size: fbeFullSize }
2586 }
2587
2588 /**
2589 * 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